‎2008 Feb 07 9:26 AM
Hi Gurus,
How to find the no of alphabets,Upper case charecters, Lowercase charecters, numbers,special charecters in a given string ??
Thanks in advance,
Sriram.
‎2008 Feb 07 9:32 AM
You have to find it using FIND statement and comparing with characters.
‎2008 Feb 07 9:32 AM
You have to find it using FIND statement and comparing with characters.
‎2008 Feb 07 9:40 AM
Hi,
DATA : v_string TYPE STRING value 'Ab1234Def',
v_num TYPE i,
v_chcnt TYPE i, " char count
v_nucnt TYPE i, " Number count.
v_spcnt TYPE I.
v_num = strlen( v_string ).
DO v_num TIMES.
IF v_string+0(1) CA SY-ABCDE.
v_chcnt = v_chcnt +1.
ELSEIF v_string+0(1) CA '0123456789'.
v_nucnt = v_nucnt + 1.
ELSEIF v_string+0(1) CA '~!@#$%^&*'.
v_spcnt = v_spcnt + 1.
ENDIF.
ENDDO.
Don't forget to reward if useful
‎2008 Feb 07 10:04 AM
Hi,
I forgot add some more logic here.
DATA : v_string TYPE STRING value 'Ab1234Def',
v_num TYPE i,
v_chcnt TYPE i, " char count
v_nucnt TYPE i, " Number count.
v_spcnt TYPE I,
v_count TYPE i.
v_num = strlen( v_string ).
DO v_num TIMES.
v_count = v_count + 1.
IF v_string+0(v_count) CA SY-ABCDE.
v_chcnt = v_chcnt +1.
ELSEIF v_string+0(v_count) CA '0123456789'.
v_nucnt = v_nucnt + 1.
ELSEIF v_string+0(v_count) CA '~!@#$%^&*'.
v_spcnt = v_spcnt + 1.
ENDIF.
ENDDO.
Don't forget to reward if useful...