‎2006 Feb 28 11:36 AM
Hi ,
I have a string in this way .
<b>' Welcome # to## ABA#P '</b>
I would like to remove the occurances of # so that the string output will be
<b>' Welcome to ABAP '</b>
if i use the replace and the condense statements, the output is wrong and the data im getting is incorrect and is in the following was ' WelcometoABAP '
Any solution to this ???
Regards
Mustameer
‎2006 Feb 28 11:58 AM
Hello,
Just copy paste the code....
data: str type string.
str = 'Welcome # to## ABA#P'.
replace all occurrences of substring '#' in str with ' '.
write: str. " String with gaps..."
condense str.
write: str.
Hope it helps.
Regards,
Maheswaran.B
‎2006 Feb 28 11:43 AM
Hi Mustameer
yes condense will remove leading and closing blanks are completely removed and any other directly consecutive blanks are all replaced by exactly one space character or - if NO-GAPS is specified - are also removed completely.
regards
kishore
‎2006 Feb 28 11:45 AM
Use REPLACE ALL OCCURRENCES OF '#' WITH SPACE.
regards,
Suresh Datti
‎2006 Feb 28 11:46 AM
DATA: A(4) TYPE C,A1(20) VALUE 'Welcome # to## ABA#P'.
REPLACE ALL OCCURRENCES OF '#' IN a1 with space.
write a1.
its working
<b>reward if useful</b>
‎2006 Feb 28 11:50 AM
The ourput that i get when i use the all occurances option is 'Welcome to ABA P ' as the # will be replaced by a ' ' .
but i want to know how do i remove this space while maintaining the space b/w the words .
‎2006 Feb 28 11:57 AM
You have to split the string into two diff strings & use CONDENSE on the string that holds 'ABA P'; And the concatenate the two strings separated by space.
Suresh Datti
‎2006 Feb 28 12:00 PM
HI khan
then you have concatenate
field = 'welcome to aba p'.
concatenate field0(14) field15(1) into field.
regards
kishore
‎2006 Feb 28 12:01 PM
hi,
DATA: A(4) TYPE C,
A1(20) VALUE 'Wel#ome # to## A#A#P '.
REPLACE ALL OCCURRENCES OF '#' IN a1 with space.
write a1.
O/p which i got : Welome to AAP.
i had tried the code and it is wrking fine , infact it will take care of the space by itself.
Cheers
Sunny
‎2006 Feb 28 12:13 PM
its working fine for me too...just copy my code and try in ur system...
<b>reward if useful</b>
‎2006 Feb 28 12:16 PM
Thank you everybody,
Issue resolved.
Appropriate points alloted
‎2006 Feb 28 11:49 AM
Hi,
try this....
string = ' Welcome # to## ABA#P '
REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB IN string WITH SPACEwrite: string.
Regards
vijay
‎2006 Feb 28 11:58 AM
Hello,
Just copy paste the code....
data: str type string.
str = 'Welcome # to## ABA#P'.
replace all occurrences of substring '#' in str with ' '.
write: str. " String with gaps..."
condense str.
write: str.
Hope it helps.
Regards,
Maheswaran.B
‎2007 Apr 05 3:42 PM
Without your string manipulation you can do the following way.
Your string ' Welcome # to## ABA#P '
Replace # value with null value, usually with this '' (single quotes) not with the space.
I think this should resove your issue.