on 2006 Jan 12 2:21 PM
Hi,
I would like to replace each space characater by the ' ' code in a string.
(for HTML presentation)
I try to write a macro to make this job, but .. I'm not able to make it work.
Regards
Frédéric
You can do something like this.
report zrich_0003 .
data: this_string type string.
this_string = 'This is the string'.
while sy-subrc = 0.
replace space with ' ' into this_string.
endwhile.
write:/ this_string.
You could also use the statement instead of th WHILE loop...
REPLACE ALL Occurrences of space in this_string with ' '.
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oops, yes, I forgot. You need to specify the length.
report zrich_0003 .
data: this_string type string.
data: length type i.
this_string = 'This is the string'.
length = strlen( this_string ).
REPLACE ALL Occurrences of space in this_string+0(length) with ' '.
write:/ this_string.
Regards,
Rich Heilman
Hi,
Yes, it results in dump, bcauz there is no terminating condition to come out of the loop ('all occurrences')
sorry guys, couldnt make translate work.
Try translate command.
Regards,
Raj
Message was edited by: Rajasekhar Dinavahi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.