Replace Single Quote in Java using str.replaceAll()


Replace Single Quote in Java using str.replaceAll()

To replace single quote in java you have to escape four times the single quote in replaceall string method.

String input = "Replace Single Quote's in Java";
String output = input.replaceAll(" ' ", "\\\\' ");
System.out.println(output);

Related Posts:

2 Responses


venkat December 10, 2008 at 12:12 pm

Thanks this was rearlly useful to me..


Pratheeba December 10, 2008 at 12:12 pm

ya!!!!!!
This is very very useful to me


Comments are closed.