Advertisement

04.22.2008 at 06:09PM PDT, ID: 23345165
[x]
Attachment Details

How do I strip all the \n and \r's from a string using the replaceAll function?

Asked by richardsimnett in Java Programming Language

Hello,
I need to strip all the \n's and \r's from a string prior to processing it into a specific Quoted Printable RFC standard.. How do I do this using the Strings replaceAll(String, STring) function?

See below to see what ive got that isnt working.

Worth 500 points.

Thanks,
RickStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
StringBuffer retval = new StringBuffer();
    
      int place = 74;
      int lastPlace = 0;
    
      String test;
      
      htmlbody.replaceAll("\r\n","");
      //htmlbody.replaceAll("\\r","");
      
      while (lastPlace < htmlbody.length())
      {   
        if (place > htmlbody.length())
            retval.append(htmlbody.substring(lastPlace,htmlbody.length()));
        else    
            retval.append(htmlbody.substring(lastPlace,place) + "=\n");
        
        lastPlace = place + 1;
        place += 75;
      }
[+][-]04.22.2008 at 06:13PM PDT, ID: 21416971

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.22.2008 at 06:15PM PDT, ID: 21416987

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Sign Up Now!
Solution Provided By: objects
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.22.2008 at 06:16PM PDT, ID: 21416997

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:19PM PDT, ID: 21417019

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:23PM PDT, ID: 21417037

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:25PM PDT, ID: 21417053

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:29PM PDT, ID: 21417076

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:34PM PDT, ID: 21417096

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:35PM PDT, ID: 21417099

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 08:11PM PDT, ID: 21417509

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628