problem with single quote
in the below code i want to replace single quote character with some other character.
i am getting error in replacing single quote.how can i do this.
please help me.
class test
{
public static void main(String[] args)
{
String str="don't";
String str1=str.replace(''','#');
System.out.println(str1);
}
}
[398 byte] By [
reddy94] at [2007-9-26 2:49:31]

> in the below code i want to replace single quote
> character with some other character.
> i am getting error in replacing single quote.how can i
> do this.
> please help me.
>
> class test
> {
> public static void main(String[] args)
> {
> String str="don't";
> String str1=str.replace(''','#');
> System.out.println(str1);
> }
> }
\ is the escape character so it should be:
String str1=str.replace('\'','#');