‎2005 Jul 25 3:13 AM
hi...
how can i read a srting character by character. for example if i have a string like srikanth i want to get all the characters like 's' 'r' 'i' 'k' 'a' 'n' 't' 'h' .
thanku all...
prasad.
‎2005 Jul 25 5:48 AM
Hi, maybe this problem has already been solved.
But I have a interesting solution for it.
Paste in following:
DATA: STR(100) TYPE C,
ITAB TYPE STANDARD TABLE OF CHAR1.
STR = 'HELLO WORLD'.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING TEXTLINE = STR
OUTPUTLEN = 1
TABLES OUT_LINES = ITAB.
BREAK-POINT.
‎2005 Jul 25 3:26 AM
hi,
LOOP.
IF i < STRLEN( <string> ).
chr = <string>+i(1).
i = i+1.
ELSE.
exit.
ENDIF.
ENDLOOP.
Regards,
Andrej.
‎2005 Jul 25 3:38 AM
Hi,
You can read it like this.
Data : len type i,
a type c,
b type i.
i = strlen( string ).
Do i times.
b = sy-index - 1.
a = string+b(1).
write a.
enddo.
Regards,
Gagan
‎2005 Jul 25 5:08 AM
Well depending on you character set you really have to take into account the fact that you might be dealing with a multibyte character set.
The best bet would be to transform your string into a char[] character array and walk through it. This should hopefully negate the differences between multibyte and single byte character sets.
Enjoy
‎2005 Jul 25 5:48 AM
Hi, maybe this problem has already been solved.
But I have a interesting solution for it.
Paste in following:
DATA: STR(100) TYPE C,
ITAB TYPE STANDARD TABLE OF CHAR1.
STR = 'HELLO WORLD'.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING TEXTLINE = STR
OUTPUTLEN = 1
TABLES OUT_LINES = ITAB.
BREAK-POINT.