HI all,


I would like to replace the substring "\r\n" (consisting of the _4_ characters; '\' 'r' '\' 'n') in a string. I use the replace method of org.apache.commons.lang.StringUtils, but I am not sure if I 'escape' it correctly.


For example, string "line1\r\nline2\r\n" should become "line1=0D=0A=line2=0D=0A=".

This is the oce I am using of the example:

String string = "line1\r\nline2\r\n";
string.indexOf("\\r\\n"); // Return the index of the place found
                          // (and correct!!).
string = StringUtils.replace(string, "\\r\\n", "=0D=0A=");
                          // Does not replace the search string.
                          // result is equal to original.


Now I am wondering whether there is a difference with the escaping or if I am doing something incorrect.

Does some one has an idea?

hints appreciated,
Harrie








--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to