PDA

View Full Version : converting string to integer


phani
08-29-2002, 07:31 AM
can any one tell how to convert string to integer iam passing the integer value as a string and i wish to convert into integer.
can i do it eval if so how? can any one show the syntax of it

glenngv
08-29-2002, 08:24 AM
you can convert string to number in 2 ways:

if the string to be converted is only composed of numbers, use:
Number(string)

if the string to be converted can have letters and numbers and you want to just get the number, use:
parseInt(string,10)