I am newbie for java language. I am want to split the string "mandar\jitendra\sadye" to 3 strings "mandar","jitendra" and "sadye" using split function in string library. The program that I use to split the string is as follow:
public class string
{
public static void main(String[] args)
{
String mandar="mandar\\jitendra\\saye";
String[] words=mandar.split("[\\]");
for(int a=0;a<words.length;a++)
{
System.out.println(words[a]);
}
}
}
But this program gives this error
If i replace '\' by any other escape sequence like'\0' then program runs just fine
I already tried using ['\'] [] [\] ['\'] [\] but none of these tokens are working for me.
So is there a some special way for for splitting a string across '\'?