Hi,
I have a
string as
String comments = don't do canada.
I want to replace this single quote with two single quotes.
I tried like
char c;
for(int i=0; i<comments.length(); i++){
c = comments.charAt(i);
if(c == '\''){
comments.replace("\'","\'\'");
}
}
System.out.println("The replaced string is : " + comments);
This worked fine in
java version 1.5
But it is throwing some error in java version 1.4.2.10
Can anybody pls tell me how to replace a single quote with two single quotes?