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!

Convert string 2

Status
Not open for further replies.

tseh

Programmer
Jan 13, 2000
64
CA
How do I convert a string to a number?
 
From vbscript documentation:

CInt(expression)
Returns an expression that has been converted to a Variant of subtype Integer.

CLng(expression)
Returns an expression that has been converted to a Variant of subtype Long.

CSng(expression)
Returns an expression that has been converted to a Variant of subtype Single.

CDbl(expression)
Returns an expression that has been converted to a Variant of subtype Double.

There's more but this should get you going.





 
So for a quick example:

MyVariable = CLng(MyVariable)

But you should experiment with things like this to be sure that it doesn't cause an error with unexpected input so IsNull() and IsNumeric() are good functions to know too.

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top