developerinlondon
Programmer
I am trying to use the split method to split a string by '|' into an array of strings, the code looks like belwo:
now if I want to iterate over slist I find that it put all the letters in individually, ie f, i, r, s, t,... etc.
any ideas how i can get it to split by bar? (i tried s.split("\|"), that doesnt compile.
thanks in advance.
Code:
String s = "first sentence|second sentence|third sentence";
String[] slist = s.split("|");
now if I want to iterate over slist I find that it put all the letters in individually, ie f, i, r, s, t,... etc.
any ideas how i can get it to split by bar? (i tried s.split("\|"), that doesnt compile.
thanks in advance.