replace all occurences of "\x0d" in a Java String [duplicate]
Possible Duplicate:
How do I replace a character in a string in Java?
how 开发者_如何学Gocan i replace all occurences of '\x0d' in a Java String??
- I have tried myString.replaceAll("\x0d", "")... does not works
and all the answers below does not work have tried that already
OMG :)
Apologies for the crap guys.
I believe you want this:
String test = "\r".replace("\r", "princess");
System.out.println(test); // princess
ASCII 13 is Carriage Return
Escape the backslash:
myString = myString.replace("\\x0d", "whateverYouWantToReplaceWith")
See it working on ideone.
You may consider trying String.replace.
Just a guess -- String.replace? There's a character version and a "character sequence" version.
myString.replaceAll("\\x0d","whateverYouWantToReplaceWith");
精彩评论