Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to convert a string to a number in java? 1

Status
Not open for further replies.

jfdabiri

MIS
Feb 27, 2007
282
US
hi,
i'm working with a web page that has a field with data like this: $25.00 or $75.00 or 75.00 or 25.00
i have to take this field, convert it into a number and add 25 to it and put it back in the field. i can process the content of the field in java, but having trouble converting this format into a number. any ideas?
thanks.
 
number(%stringValue%)

converts a string to it's numeric equivalent

To build may have to be the slow laborious task of years. To destroy can simply be the thoughtless act of a single day.
 
To convert a number using vbscript (in ASP), you can use any of the conversion functions. So, if you want to use integers, you can use the CInt() function, for example. But your problem is not expressed very well so I'm not sure if this is what you need. Also, what does Java have to do with anything in ASP?

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
chopstik, i'm using javascript in my subroutine. i want to convert a field that can contain values like $25 or $25.00 into a number so that i can add a value to it.
thanks.
 
For Javascript, you can use the parseInt() (for integers) or parseFloat() (for other nubmers) functions to convert text to numbers.

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
that was what i was looking for. it worked like a charm.
thanks a bunch.
you deserve a star.
:)
cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top