alphanumeric vs. numeric

alphanumeric vs. numeric

Postby Iris Gesser » Wed Oct 02, 2019 10:04 am

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
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: alphanumeric vs. numeric

Postby ukoenig » Wed Oct 02, 2019 10:20 am

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
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: alphanumeric vs. numeric

Postby Iris Gesser » Wed Oct 02, 2019 11:00 am

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
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: alphanumeric vs. numeric

Postby Natter » Wed Oct 02, 2019 11:13 am

cVar:="a5b"
posrange(chr(48), chr(57), cVar) - 2
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: alphanumeric vs. numeric

Postby cnavarro » Wed Oct 02, 2019 12:57 pm

Try with
Code: Select all  Expand view  RUN

   ? hb_IsNumeric( <var> )
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: alphanumeric vs. numeric

Postby Iris Gesser » Wed Oct 02, 2019 2:12 pm

Thank you very much, this is wotking fine!
Kind regards
Iris
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests