Page 1 of 1

alphanumeric vs. numeric

Posted: Wed Oct 02, 2019 10:04 am
by Iris Gesser
Hello,

can you help me please?
I have to find out if a character variable inside is alphanumeric or numeric.
Is there an easy command, that I can use?

Thank you in advance, kind regards
Iris

Re: alphanumeric vs. numeric

Posted: Wed Oct 02, 2019 10:20 am
by ukoenig
Hallo Iris,
I have to find out if a character variable inside is alphanumeric or numeric.
VAL returns the info You are looking for

Msgalert( VAL( "aaa" ) ) = 0
Msgalert( VAL( "111" ) ) = 111

best regards
Uwe :D

Re: alphanumeric vs. numeric

Posted: Wed Oct 02, 2019 11:00 am
by Iris Gesser
Hello Uwe,

thank you for your answer.
I have tried with VAL, but this is not the solution.

local cNumber = "1S2673Z"
msginfo(VAL(cNumber)) = 1

I think VAL evaluates cNumber until the first non-numeric character.

Thank you and kind regards
Iris

Re: alphanumeric vs. numeric

Posted: Wed Oct 02, 2019 11:13 am
by Natter
cVar:="a5b"
posrange(chr(48), chr(57), cVar) - 2

Re: alphanumeric vs. numeric

Posted: Wed Oct 02, 2019 12:57 pm
by cnavarro
Try with

Code: Select all

   ? hb_IsNumeric( <var> )
 

Re: alphanumeric vs. numeric

Posted: Wed Oct 02, 2019 2:12 pm
by Iris Gesser
Thank you very much, this is wotking fine!
Kind regards
Iris