I have a string that came from an array called fld[1].tostring. When i try and split this string which returns "|R1|R2|R3" on the | it splits it into each character. what am i doing wrong?
The split method accepts regular expressions. The pipe character is used to denote a logical or in Java regular expressions. Escape the character with a backslash to split on it.
For example:
String s = "|R1|R2|R3";
String[] a = s.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