6 Replies Latest reply on Jan 15, 2009 7:35 PM by 807589

    How to replace special characters by "" in Java ?

    807589
      Dear Java Community,

      I am calling one method which pulls the String object from database. (Contents of the String object is as mentioned below, ie the email contents)
      ____________________________________________________
      From : ABC
      To : XYZ
      Sent at : 01/14/2009 12:30 PM
      ____________________________________________________
      Approved by JKL

      Then using the replaceAll method, I am trying to replace "\n" and "\t" by "" but it is not working.

      MyString s = "Above content";
      s.replaceAll("\\n","");
      s.replaceAll("\\t","");
      System.out.println(s);

      Can some one help me ? Do I need to use      replaceAll(String regex, String replacement) ??

      Thanks in Advance
      Mithuan