Code center > Darwinbots Program Source Code

String Integer Check

<< < (2/2)

PurpleYouko:

--- Quote ---"IsNumeric" will return true if the argument can be expressed as an integer and false if it can't...
--- End quote ---
Didn't know there was such a function. Thanks for the info Ulc.

Ulciscor:
"val(string)" will return 0 if the argument isn't a number.

PurpleYouko:

--- Quote ---"val(string)" will return 0 if the argument isnt a number.
--- End quote ---

Just tested it and you are right. It does return 0.

Must have been thinking about VB for Applications.

No apparently not. Just tested that too and it returns 0

Could have sworn I had seen crashes in this kind of code.  :blink:

Maybe I am just going senile.  :wacko:

Ulciscor:
Lol :D

I had a go at using "CInt(string)" on non-numerical strings and that indeed crashes as you might expect... was this what you were thinking of?

PurpleYouko:
quite possibly. I don't tend to use "val" very much as the output format is limited.

Navigation

[0] Message Index

[*] Previous page

Go to full version