Sign in to follow this  
Followers 0
danpaul23

confusion about number function

3 posts in this topic

When I try to make a number with a comma in it into a number, the number function deletes everything after the comma (which I thought, was what the Int function is supposed to do).

For instance in the following code:

CODE
$Var1 = "27,350"

$Var2 = Number($Var1)

msgbox(0, "", "result: " & $Var2)

I get the result "27", when I want 27350.

I'm sure this is an easy fix but I couldn't find anything in the help file or elsewhere.

Thanks for your help.

Share this post


Link to post
Share on other sites



You can try this.

$Var1 = "27,350"
$Var2 = Number(StringReplace($Var1,",",""))
msgbox(0, "", "result: " & $Var2)
great, that seems to work, no matter how many commas or if there a none in the expression.

thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0