Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Is there a function to test if a variable contains a numeric value?


J. Magnin Aug 3, 2016 11:29 AM

Hello everybody,

I have to check an user input, received from an SMS command. The SMS command looks like "CMD,VALUE", where "VALUE" must be a number (integer or floating point, depending on the command). Is there a way to check that "VALUE" is a number ?

I know than there are commands in StarBasic or VBA (IsNumber or IsNumeric) to check that, but I couldn’t find something similar within CRBasic.

Thanks,

J. M.


pokeeffe Aug 3, 2016 05:18 PM

You might try using `SplitStr` with option 0 for `SplitOption` and checking for NAN.

I think I've also had success with typecasting like this:

var inputstr as String
var num

inputstr = "18"
num = inputstr

 

Log in or register to post/reply in the forum.