• Post Reply Bookmark Topic Watch Topic
  • New Topic

replacing \' with ' in string  RSS feed

 
auvrm papu
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to find and replace all \' to '

basically

input = "Hello \' Here is \' quote";
ouput = "Hello ' Here is ' quote";

The following didn't help
Pattern pattern = Pattern.compile("[\\\\']");

Any help is appreciated.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
string.replace("\\\'", "'"); should work
 
auvrm papu
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

Actually string.replaceAll("\\\\'", "'")); worked!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!