Convert String to Number..help Pls!!

Thread: Convert String to Number..help Pls!!

1. minni Guest

Convert String to Number..help Pls!!

I am reading a number of string values as follows...<BR><BR>FROM=MIA /TO=GCM /DEPDATE=01OCT /RETDATE=15OCT /RETTIME=9A /DEPTIME=9A /FARE=1059.20<BR><BR>I have used Instr function to capture the fare value <BR><BR>Now how can I convert the FARE value to Number so that I can do further calculations with it.<BR><BR>Thanks!!<BR>

2. Senior Member
Join Date
Dec 1969
Posts
626

RE: Convert String to Number..help Pls!!

From http://msdn.microsoft.com/scripting<BR>(the VBCript reference link along the side)<BR><BR>CDbl([expression]) <BR><BR>Where Expression is your string value...<BR><BR>HTH

3. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

RE: Convert String to Number..help Pls!!

Well you "CAN" use cdbl() or cint(). It all depends. If the numbers you get are going to ONLY be integers i would sugges you only use the cint function.

4. Dan White Guest

RE: Convert String to Number..help Pls!!

You could try using the CCur function.<BR><BR>The CCur function converts any number to the variant of subtype Currency. <BR> <BR>Converts to currency values ranging from <BR>-922,337,203,685,477.5808 to 922,337,203,685,477.5807 <BR> <BR>Code: <BR>&#060;% anynumber=(12345) %&#062; <BR>&#060;% =CCur(anynumber) %&#062; <BR> <BR>Output: <BR>12345 <BR> <BR>This function rounds off to 4 decimal places. <BR> <BR>Code: <BR>&#060;% anynumber=(55555.123456) %&#062; <BR>&#060;% =CCur(anynumber) %&#062; <BR> <BR>Output: <BR>55555.1235 <BR><BR>Good luck!

5. minni Guest

thanks g-mny, Akilesh, Dan White! Thank you all! :

thank you

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•