Sign in to follow this  
Followers 0
Ace08

number conversion

3 posts in this topic

hi guys i have sample code.

$a = ':59:/12345678'
$a = stringReplace($a, ":59:", "")
$a = stringReplace($a, " ", "")
$a = stringReplace($a, "-", "")
$a = stringReplace($a, "/", "")
if isnumber($a) then
MsgBox(0, "line", $a)
else
MsgBox(0, "error", 'Not a Number')
endif

as you can see the the value of $a before it starts to do the if statement will be "12345678" but then again the msgbox that i am getting is the second one "Not a number". so i came up with the conclusion that $a is still a string, question is how do i do this? (what i mean is how would the script know if its already a number or not?)


Work smarter not harder.My First Posted Script: DataBase

Share this post


Link to post
Share on other sites



The helpfile is very clear that StringReplace() returns a string.

To convert a string to a number see Number(), but you probably want StringIsDigit or one of the related functions.

Share this post


Link to post
Share on other sites

thanks for the info AdmiralAlkex its now working ;)


Work smarter not harder.My First Posted Script: DataBase

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