faqts : Computers : Programming : Languages : Asp : ASP/VBScript : Functions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

145 of 397 people (37%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How do you convert from string to numeric i.e. "123" to 123

Oct 9th, 2002 12:56
Cesar Gil, Ambrozy Lorinc, Ed Davis,


Please use the cLng, or the cInt function.
strVar = "123"
If isNumeric(strVar) Then 
  lngVar=cLng(strVar)
End If
You may also use the cSng function is your string may contain a decimal 
point and should be converted to a floating point number.
strVar = "123.45"
If isNumeric(strVar) Then
  sngVar=cSng(strVar)
End If



© 1999-2004 Synop Pty Ltd