Replace all occurrences of ENTER in a string

Hi,
I have a string which contains line breaks:
'<HTML><HEAD>
</HEAD>
<BODY>'
and it is shown to me in the debugger as:
'<HTML><HEAD>#</HEAD>#<BODY>'
Now I want to replace all line breaks in the string,
but
replace all occurrences of `#` in text with ' '.
doesn't work.
So if you have an idea how to replace the # symbol for Enter in a string please tell me ;).
regards,
Stefan

Hi,
Pls use
replace all occurences of '#' in text with cl_abap_char_utilities=>newline.
Eddy

Similar Messages

  • Replacing all occurrences of characters in a string with one new character?

    Hi there,
    I'm looking for a way that I could replace all occurrences of a set of specific characters with just one new character for each occurrence.
    For example if I have a string which is "word1...word2.......word3....word4............word5" how would I be able to replace this with just one character such as ":" for each set of "." so that it would essentially appear like this "word1:word2:word3:word4:word5"
    If I just use replace(".", ":") I am left with "word1:::word2:::::::word4::::word5::::::::::::"
    So therefore I'm guessing this would require the use of replaceAll() maybe? but I'm not really very familiar with how regular expressions work and how this would be accomplished using them.
    Any help would be greatly appreciated :) Thanks.

    Yes, but "." means any character, so ".\+" means "any character repeated more than once". If you just mean a full stop ("period" for you Americans :p) you should use "\.+" as your regular expression, but remember that for Java you need a '\' escape to recognise '\' as '\', so in code you'd actually type your regex as:
    "\\.+"Here's an example of one way to do it:
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class Test {
        public static void main(String[] args) {
           String string = "example1.......example2...example3.....example4";
         Pattern pattern = Pattern.compile("\\.+");
         Matcher stringMatcher = pattern.matcher(string);
         string = stringMatcher.replaceAll(":");
         System.out.println(string);
    }Edited by: JohnGraham on Oct 24, 2008 5:19 AM
    Edited by: JohnGraham on Oct 24, 2008 5:22 AM

  • DUMP: replace all occurrences of space in string1 with string2.

    Why does this statement results in a dump:
    replace all occurrences of space in string1 with string2.
    same with
    replace all occurrences of ' ' in string1 with string2.
    string2 is a string without spaces!
    Is there any drawback on using this statements as a workaround?
    while sy-subrc eq 0.
      replace space with string2 into string1.
    endwhile.
    Thanks
    norbert

    Hi,
    See this example i got from ABAPDOCU
    replacing values
    DATA: t4(10) TYPE c VALUE 'abcdefghij',
          string4 LIKE t4,
          str41(4) TYPE c VALUE 'cdef',
          str42(4) TYPE c VALUE 'klmn',
          str43(2) TYPE c VALUE 'kl',
          str44(6) TYPE c VALUE 'klmnop',
          len4 TYPE i VALUE 2.
    string4 = t4.
    WRITE string4.
    REPLACE str41 WITH str42 INTO string4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str42 INTO string4 LENGTH len4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str43 INTO string4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str44 INTO string4.
    WRITE / string4.
    SKIP.
    ULINE.
    Example for condensing strings
    DATA: string9(25) TYPE c VALUE ' one  two   three    four',
          len9 TYPE i.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    CONDENSE string9.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    CONDENSE string9 NO-GAPS.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    SKIP.
    ULINE.
    Thanks & Regards,
    Judith.

  • Replace all occurrence with range - issue

    Hi,
    I have a range with "letters" like ":" or "-" or "."
    Note: all entries are with option = "equal"
    Now i need to "replace all occurrences" of "all entries in that range" with space.
    idea:
    loop at range assigning <range>.
    replace all occurrences of <range>-low in aaa with space
    endloop.
    Any better ideas ?
    Regards,
    Gordon

    Sorry but i think my question was not clear.
    is there another way instead of using the "loop" ?
    The translate or replace statement is not the problem
    thx,
    Gordon

  • Replace all TAB and ENTER characters in a column

    Hi,
    how can I replace all chr(9) & chr(12) characters in a column?
    The following SQL replaces on one occurrence of TAB & ENTER, but my column can have many TAB & ENTER characters.
    select trim(replace(replace(column1,chr(9),''), chr(13), '') from some_table;

    Please cut'n'paste a sample from a SQL*Plus session, like this:
    SQL> select 'a'||chr(9)||'p'||chr(9)||'c'||chr(9)||'!'||chr(13)||'!'||chr(13)||'!'||chr(13)||'!'
      2  from dual
      3  /
    'A'||CHR(9)||
    a       p       c       !
    SQL> select replace(replace('a'||chr(9)||'p'||chr(9)||'c'||chr(9)||'!'||chr(13)||'!'||chr(13)||'!'||
    chr(13)||'!', chr(13), ''), chr(9), '')
      2  from dual
      3  /
    REPLACE
    apc!!!!
    SQL> Cheers, APC

  • Replace last occurrence of a word in string

    Hi,
    I need to replace a last occurrence of a word in string. Form example:
    'I like fruits and also like vegetables'  need to replace last occurrence of "like" which is just before vegetables and not the "like" before the fruits.

    One of the solution to use the last occurrence dynamically
    applicable to prior version of 11g
    SELECT REGEXP_REPLACE (str, 'like', 'hate', INSTR (str, 'like', -1))
      FROM (SELECT 'I like fruits and also like vegetables also like mango' str FROM DUAL)
    applicable to 11g
    SELECT REGEXP_REPLACE (str, 'like', 'hate', 1, REGEXP_COUNT (str, 'like'), 'i') data_col
      FROM (SELECT 'I like fruits and also like vegetables also like mango' str FROM DUAL)

  • About REPLACE ALL functionality

    Dear All,
    I have one string which contains '#' in between. And I want to replace all these '#' with ' ' (ie blank SPACE)..
    For this I am using:-
    REPLACE ALL OCCURRENCES OF '#' IN L_TEXT WITH ' '.
    But to my greatest surprise, its not able to replace it saying sy-subrc = 4 ie its not able to locate '#'.
    I have observed following:-
    1. Suppose L_TEXT = 'corrective action## is that# to be #taken'
    then replace all fails.
    2. But suppose L_TEXT = 'corrective action # # is that # to be # taken'
    then its works.
    I tried the option of
    REPLACE ALL OCCURRENCES OF REGEX '#*' IN L_TEXT WITH ' '.
    But its putting ''#" after every character !!!
    And the same functionality works with CRM4.0's ABAP editor but now when i am using it in CRM2007's ABAP editor, its not woking.
    I have tried it in ABAP editors of other systems like PRD n all. Its working there too.
    Can anybody please shed some light on this?
    regards,
    Amey Mogare

    Yes Matt,
    I suspect its not the actual character "#". !!!!
    Actually in one of the CRM transaction GUI, there is a Text Box where user can enter his Survey details. In this, if he enters a newline then in FM i'm getting it as "#"... What I mean is if I write :-
    Heading 2: h2.
    Containment text
    is as follows
    line 1
    line2
    Heading 2: h2.
    Then in FM's field its represented as
    Heading 2: h2.
    Containment text# is as follows# line 1# line2
    Heading 2: h2.
    But this is getting messed up in when we dump it into excel sheet.
    So how do i replace these with Spaces?
    sample code line would be very helpful.
    Thanks a lot for pointing this out.
    regards,
    Amey

  • Replace all occurences in 4.6c

    Hi,
    I have a program which analyse system and gives some output.(Regarding programs,FM's etc).
    I need to run this my present server which is of 4.6c.
    But this program developed in ECC 6.0 and when i loaded this notepad program it was giving some errors.
    One error is REPLACE all occurrences of '('  in i_userexit-txt WITH space.
    In 4.6 c it is not accepting ALL OCCURENCES.
    It is accepting only Replace first occurence.
    What i need to do to replace all occurences in 4.6C?
    I there any statement to replace all Occurences?
    I searched in ABAP help  for 4.6c also.
    Please help to correct this.
    Regards,
    Krishna.

    you can do something like this, this wil do REPLACE ALL OCC...:
    WHILE sy-subrc EQ 0.
    REPLACE ... " acc. to 4.6 Syntax ...
    ENDWHILE.

  • Substitutions Replace All

    Since I like to output manuscrupts to ePUB for reading in iBooks, I prefer to have typographical quotation marks—smart quotes—on. Pages 5's parity with Pages for iOS made it more difficult to globally search-and-replace ordinary quotes (inch marks) with smart quotes from the Find & Replace dialog. (The crippling of the Find & Replace even more is a subject for another rant ) But it seemed Pages 5 has the answer in its Show Substitutions submenu.
    In the help, it says:
    Choose Edit > Substitutions > Show Substitutions (the Edit menu is at the top of your computer screen).
    In the Substitutions window, select the Smart Quotes checkbox.
    Choose a quotation mark style from each of the pop-up menus.
    Click a button to replace all occurrences of quotation marks in the document, or just in the selected text.
    Which I thought means if I have straight quotes and double-dashes, hitting "replace all" or "replace in selection" will convert them to curly quotes and em dashes.
    But it doesn't.
    So far as I can tell, nothing happens.
    Knowing that a lot of this is actually shunted into OS X's Text preferences, I tried making sure the Text preferences were set properly, quit all apps, restarted, opened Pages, opened a new document, typed in a test sentence with straight quotes and double-dashes, and then did the above Help procedure.
    Nope. Still nothing happens.
    I hope this is a bug and not another "refinement". I reported it as a bug.
    This wouldn't matter on documents edited on the Mac, since typing smart quotes and em dashes still work. Moving around from Pages on iOS, however—where getting to the correct quotes is a bit of a chore—I liked being able to do a global "smartify my quotes" on Pages on Mac. But like I said, can't seem to do that anymore—and the Help seems to say that I should, using the Substitutions dialog.
    Have you gotten this to work? Have I misinterpreted what the Substitutions submenu and dialog is supposed to do?

    A workaround, of sorts. After pasting large amounts of text (full of straight quote marks and straight apostrophes) into Pages documents I, too, have tried and tried to convert to smart quotes, only to be frustrated. (I also spent quite a bit of time on the phone in November 2014 with a Pages tech support person, and he could not provide an answer. He promised to pass this on to the Pages team. This is where you start holding your breath...) Here is my workaround until (if) Apple fixes this. You are going to groan when I say this, but if you have Word on your Mac simply copy and paste the text into Word. (Perhaps you may find another word processor that does the same thing.) There the conversion is quick and simple. Then paste it back into Pages. I happen to have an older copy of Word because I was forced to start using Pages when the version of Word would not utilize the Retina display on my new Power Book an everything was fuzzy.

  • REPLACE ALL OCCURRENCIES

    Hello
    Can somebody explain me the logic of ALL OCCURRENCIES in the the example below :
    I think that this operator should replace A , ! with ' ' but the real output is different.
    The real output is AA!A. It replaces all small characters with ' '. Why
    DATA : l_PD(10) TYPE C.
    l_pd = 'AbbA!A'.
    replace all OCCURRENCES OF REGEX
      '[^!"%&''()*+,-./:;<=>?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ]' in
      l_pd with ' '.

    ... and put search (patterns) characters in square brackets [[ and ]].
    See also [Regular Expressions in Routines|http://help.sap.com/saphelp_nw70/helpdata/en/42/9d6ceabb211d73e10000000a1553f6/frameset.htm]
    Regards,
    Clemens

  • Messages has replaced all my text with a load of letter A's in boxes. What is that all about. When I type a new one it is fine until I hit enter then the same thing applies. Has anyone a fix for this?

    Messages has replaced all my text with a load of letter A's in boxes. What is that all about. When I type a new one it is fine until I hit enter then the same thing applies. Has anyone a fix for this?
    Picture below, many thanks for your help.
    Jason

    Back up all data before proceeding.
    Launch the Font Book application and validate all fonts. You must select the fonts in order to validate them. See the built-in help and this support article for instructions. If Font Book finds any issues, resolve them.
    Start up in safe mode to rebuild the font caches. Restart as usual and test.
    Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t start in safe mode. In that case, ask for instructions.
    If you still have problems, then from the Font Book menu bar, select
              File ▹ Restore Standard Fonts...
    You'll be prompted to confirm, and then to enter your administrator login password.
    Also note that if you deactivate or remove any built-in fonts, for instance by using a third-party font manager, the system may become unstable.

  • Replace all special characters in a String with underscore

    I have a String which contains some special characters even(!,$,@,*....).
    I need to replace all the special characters with _ in my String. I do have an idea of using String.replace() and analogous forms, but I would be thankful if anyone can suggest me of a better and an efficient way.
    regards,
    fun_one

    Kaj,
    Thx for your earnest reply. I did have a peep into the API on this method. But the regular expression that I need to use here was beyond my understanding. It did specify some regex that I put to use (something like myString("\D","_"), assuming that I need to replace all non-digit characters ), but it really did not help me getting the result.
    Would you spare some code for me reg. the usage of regular expressions in such a scenario?
    cheers,
    fun_one

  • Replace all ', , ' inside string

    i have long string and with pl/sql i want to replace all ', ,' with ', null,'.
    I can use replace function like:
    prepare_insert := replace(prepare_insert,', ,',', null,');
    but it will only replace first ', ,' not all. How can i replace all?

    5th database commandment:
    Thou shalt not create dynamic insert statements!
    I think using bind variables or the using clause in the execute immediate statement would solve the problem.
    But of cause you can do it also the hard (and slow) way.
    The problem is that your search string is not correct. It does include a leading "," and leaving ",". However if the leavaing "," is also the leading "," of the next replacement part then the function can't take this into account.
    Solution 1) Take care of this while building the string in the first place.
    While concating the pieces togeather use NVL(value,'null'). If you are sure that there s no value, then write NULL.
    Solution 2) Use a double replace
    with testdata as (select 'Test, , , , ''ABC''' txt from dual union all
                      select 'Test2, , , ''ABC''' txt from dual
    select txt
          ,replace(replace(txt,', ,',',null,'),', ,',',null,')
    from testdata;
    TXT               REPLACE
    Test, , , , 'ABC'     Test,null,null,null, 'ABC'
    Test2, , , 'ABC'     Test2,null,null, 'ABC'

  • Replaces all occurnces of one String with another String in a given source

    Hi all I had found that there is a lot of interest int this topic. there is a little piece of code that I wrote for myself recently, so I fgigured that it might be helpful for some...
    This method will scan through a string "source", find all of the occurances of a String "before" and replace them with the "after".
    Enjoy :-)
    public static String replace(String source, String before, String after)
    StringBuffer sb = new StringBuffer(source);
    int startpos = source.indexOf(before);
    int endpos = startpos + before.length();
    int i = startpos;
    while( i > -1 )
         if( startpos > -1 && endpos <= source.length() )
         source = sb.replace(startpos, endpos, after).toString();
         int lastReplace = source.lastIndexOf(after) + after.length();
         if(lastReplace <= source.length())
              startpos = source.substring(lastReplace, source.length() ).indexOf(before);
                   endpos = startpos + before.length();
                   i = startpos;
         else
              i = source.length();
         else
              i = -1;
    return source;
    Oh yeah if you want, you can visit my site http://www.infobrokery.com it is where this code is used to replace the text URL with html.

    Since 1.4 the String class has a replaceAll method ...

  • Replace all in a string

    Hello,
    I need to replace all occurences of
    <image>url to a image goes here</image>
    to
    <img src="url to a image goes here"/>
    where "url to a image goes here" is a url to an image
    Could you let me know how the call to replaceAll method will look like?
    Thank you.

           line = line.replaceAll("<image>([^<]*)</image>", "<img src=\"$1\"/>");

Maybe you are looking for

  • IPhone charge and Sync issues

    Hi there I have a problem with my 3G and I sincerely hope I can et some help here. I have had my iPhone for about 18 months give or take and have had no problems with it until recently. I had a minor issue about three months into my ownership, in tha

  • Condition Types appearing two times in a Purchase Order

    Hi, The condition types are same in supplementary schema (for Info Record) and Purchase Order Calculation Schema. When I put some value against a condition type under conditions in Info Record then that condition type appears 2 times in the purchase

  • Link of AP and vendor down payment

    Hi All, Please guide me with below... what is the main purpose of creation 1)Link between accounts payable and vendor down payment request 2) accounts payable and advance to vendor GL accounts 3)what is the purpose of REVELANT CASH FLOW while creatio

  • Checking mov file in quicktime

    Hi, Is there a way to check if a video file(*.mov) is valid or not?

  • O.T. Hundreds Of Digital Filters For 15 days

    Optical filter maker Tiffen has made its digital filter software available as a free trial download. http://www.amateurphotographer.co.uk/news/Tiffen_digital_filters_now_available_as_free_15d ay_trial_news_163181.html