How to convert string to float?

J

Jason Chan

i want to covert a querystring to float number in asp.
what function should i use?

i know cint() can convert string to int
but how about float?
 
M

Martin CLAVREUIL

hi,

usually you can use the round function.
As asp deals with the variant type, something tlike that should work

'querystring : ?id=1&value=10.874
id=request.querystring("id")
v=request.querystring("value")
v=round(v,3)
 
A

Alan

CDbl() or CSng() will do the trick. Use IsNumeric() to make sure it's
numeric first.

Alan
 
J

Jason Chan

I got it, thanks~
Martin CLAVREUIL said:
hi,

usually you can use the round function.
As asp deals with the variant type, something tlike that should work

'querystring : ?id=1&value=10.874
id=request.querystring("id")
v=request.querystring("value")
v=round(v,3)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top