Try the following:
String[] = "abcde|12345|xyz".split("|");
The results will not be as (at least I..) anticipated.
Using any other character seems to be ok.
String[] = "abcde,12345,xyz".split(",");
So what is special with the pipe?
Java String.split() expects a RegExp and the pipe character has special meaning in RegExps other than a comma. Try the following:
String[] = "abcde|12345|xyz".split("\\|");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With