I have a string that\'s like this: 1|\"value\"|;
1|\"value\"|;
I want to split that string and have chosen | as the separator.
|
My code looks like
Try this: String[] separated = line.split("\\|");
String[] separated = line.split("\\|");
My answer is better. I corrected the spelling of "separated" :)
Also, the reason this works? | means "OR" in regex. You need to escape it.