01-18-2008 10:04 AM
Hi all,
Can anyone tell me how I can find the position of the first character in a dynamically generated string, which has empty spaces preceding the 1st character.
For eg.,
" Hello World".
Here, the string Hello World is dynamic and in real time can be any string which the user might not know. In that case, how do I find out the position of the first character or find the number of spaces existing before I encounter the 1st character ?
01-18-2008 10:30 AM
You can try this code..
DATA text(30).
text = ' My String'. "for example this is dynamic text
IF text CA sy-abcde OR text CA '0123456789'.
WRITE : sy-fdpos.
ENDIF.
01-18-2008 10:17 AM
If u want to remove leading spaces, just use following statement:
SHIFT <fieldname> LEFT DELETING LEADING SPACES
01-18-2008 10:30 AM
You can try this code..
DATA text(30).
text = ' My String'. "for example this is dynamic text
IF text CA sy-abcde OR text CA '0123456789'.
WRITE : sy-fdpos.
ENDIF.
01-18-2008 10:34 AM
01-18-2008 10:39 AM
HI,
For searching the string u can use
SEARCH <c> FOR <str> <options>.
for deleting the preceeding r successing space
SHIFT <c> LEFT DELETING LEADING <str>.
SHIFT <c> RIGHT DELETING TRAILING <str>.
regards
zubair