FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour alphanumeric vs. numeric
Posts: 38
Joined: Fri Apr 22, 2016 10:19 PM
alphanumeric vs. numeric
Posted: 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

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: alphanumeric vs. numeric
Posted: 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 :-)
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.
Posts: 38
Joined: Fri Apr 22, 2016 10:19 PM
Re: alphanumeric vs. numeric
Posted: 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

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: alphanumeric vs. numeric
Posted: Wed Oct 02, 2019 11:13 AM

cVar:="a5b"
posrange(chr(48), chr(57), cVar) - 2

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: alphanumeric vs. numeric
Posted: Wed Oct 02, 2019 12:57 PM
Try with
Code (fw): Select all Collapse
   ? 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
Posts: 38
Joined: Fri Apr 22, 2016 10:19 PM
Re: alphanumeric vs. numeric
Posted: Wed Oct 02, 2019 02:12 PM

Thank you very much, this is wotking fine!
Kind regards
Iris

Continue the discussion