Java string replace

Discussion in 'Software' started by gcatlin, Jun 28, 2010.

  1. gcatlin

    gcatlin

    Joined:
    Jun 28, 2010
    Messages:
    1
    I have a stored string that I am attempting to output to an existing MS Word template. The line control within the string is currently a single LF char (10), and I want to replace each occurrence with CR-LF (13-10).

    The java replaceAll method seems best for detecting the presence of the single LF (\n) char, but I am not sure how to implement the insertion of CR-LF, as the replacement field does not support the regex format.

    $str.replaceAll( "\n", "???" )

    Any recommendations? Would the replaceAll or replace method be the best for this application?

    gmc
    gcatlin, Jun 28, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernando Kohan

    JAVA VIRTUAL MUCHINE OR SUN JAVA

    Fernando Kohan, Nov 13, 2004, in forum: Firefox
    Replies:
    1
    Views:
    781
    Clark
    Nov 14, 2004
  2. dakine

    MS Java or Sun Java???

    dakine, Jul 20, 2004, in forum: Computer Support
    Replies:
    9
    Views:
    1,447
  3. newasp.net
    Replies:
    1
    Views:
    1,582
    imransyed63
    Aug 21, 2008
  4. rbnbenjamin

    Java String Problems

    rbnbenjamin, Feb 3, 2009, in forum: General Computer Support
    Replies:
    0
    Views:
    2,462
    rbnbenjamin
    Feb 3, 2009
  5. freezea
    Replies:
    0
    Views:
    2,019
    freezea
    Oct 8, 2009
Loading...

Share This Page