Devrath :
I have a string
String myString = "Hello+World+How are you";
How to replace all "+"
in myString
with empty character
I tried with: myString.replaceAll("+"," ");
What I am trying to find: Regular expression for +
so I can replace all occurrences
Output I am trying to achieve: Hello World How are you
René Link :
I usually use Pattern.quote(String)
String myString = "Hello+World+How are you";
String replaced = myString.replaceAll(Pattern.quote("+"), " ");
I think it is less error-prone if you (or someone else) need to modify the regexp later.
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=477922&siteId=1