‎2007 Feb 22 7:51 AM
Hi,
I have a string. This can sometimes contain only numbers. Is there and method to check whether the staring is a number?
Thanks
Lilan
‎2007 Feb 22 8:06 AM
Hello Lilan
Simple code:
* String contains only digits
IF ( string CO '0123456789' ). " or CO '01234567890 ' including space
ELSE.
ENDIF.Regards
Uwe
‎2007 Feb 22 8:06 AM
Hello Lilan
Simple code:
* String contains only digits
IF ( string CO '0123456789' ). " or CO '01234567890 ' including space
ELSE.
ENDIF.Regards
Uwe
‎2007 Feb 22 8:07 AM
Hi
Use this FM
NUMERIC_CHECK
STRING_OUT A123344
HTYPE CHAR
regards
Shiva
‎2007 Feb 22 8:10 AM
try this demo code -
data l_text type string.
data d1 type i.
data d2 like sy-abcde.
l_text = '12'.
d2 = sy-abcde.
translate d2 to lower case.
if l_text CA sy-ABCDE or
l_text CA d2.
write 'char'.
else.
write ' num'.
endif.
‎2007 Feb 22 8:10 AM
hi,
u can check like this...
if v_str CO '0123456789'.
---
---
endif.
regards,
priya.
‎2007 Feb 22 8:17 AM
use
if str co '0123456789'.
endif.
or fm NUMERIC_CHECK.
regards
shiba dutta
‎2007 Feb 22 8:25 AM
Hi Lilan.
Just follow the foll steps :
1. Declare var1 type d
oref type ref to cx_root.
2. Write the foll code(assuming str is your string )
try.
d = s / 2.
catch cx_sy_conversion_no_number into oref.
endtry.
3. If oref is initial, the string is a number
Else the string has some alphabets.
Ravi