‎2010 Jun 16 1:59 PM
Hello all,
I have a string which has a pipe delimited content like
|TEST1 |TEST2 |TEST3 |
I would like to change the pipe delimited content to fixed width delimit.
Any thoughts. Please let me know.
‎2010 Jun 16 3:10 PM
Replace all occurrences of '|' in lv_string with space.
condense lv_string.
For more details check the f1 help of condense statement.
‎2010 Jun 16 3:00 PM
I tried
REPLACE ALL OCCURENCES OF '|' IN STRING WITH SPACE.With this the pipe was gone but all the contents moved to left by one char. In fact I wanted to replace the pipe with actual space.
Any thoughts?
‎2010 Jun 16 3:10 PM
Replace all occurrences of '|' in lv_string with space.
condense lv_string.
For more details check the f1 help of condense statement.
‎2010 Jun 16 4:00 PM
I do not think condense would help me as it takes out all the blank spaces.
This is what I am trying to achieve.
|TEXT1 |TEXT2 |In the above string, once I do the replace with space, TEXT1 moves left to the first position (which is OK) but TEXT2 moves left by two spaces since it replaced two |. Instead for the secnod | and subsequent onces, the | should be replaced with actual space meaning in the above example, TEXT2 should move left by only one space.
Experts please help.
‎2010 Jun 16 4:57 PM
This will work
data:lv_string type string.
lv_string = '|TEST1 |TEST2 |TEST3 |'.
replace ALL OCCURRENCES OF '|' in lv_string with ` `.
shift lv_string left DELETING LEADING space.
‎2010 Jun 16 6:05 PM
replace all occurrences of 'I' with space into.... in character mode.... That doesn't work?? Can't imagine why this is happening to you.... you're not doing anything else like shift or condense?
‎2010 Jun 17 3:16 AM
>
> replace all occurrences of 'I' with space into.... in character mode.... That doesn't work?? Can't imagine why this is happening to you.... you're not doing anything else like shift or condense?
Hi,
SPACE represents an empty single-character constant (technically ' ') which has got an no length.
But ` ` represnts a string literal with space which is has got length as 1. Hence the difference with space & ` ` while using REPLACE.
You can read more about character v/s string literals on Rainer's blog.
BR,
Suhas
PS: I have no idea how CONCATENATE ... SEPARATED BY space works