josh said:
josh said:
Hi I don't understand this output:
I have this string b = "boo:and:foo";
String s[] = b.split("o");
"b", "", ":and:f", "", ""
There's an empty string between the two `o`s of `boo`, ditto `foo`,
isn't there?
sorry which string? I don't see it!
That's because it isn't there. How can you see it if it isn't there?
"o" is the delimiter. Your original string is:
b[delimiter][delimiter]:and:f[delimiter][delimiter]
remove the [delimiter]s and you are left with:
"b", "", ":and:f, "" and "".
The first string is what appears before the first delimiter. The second string
is what appears between the first and second delimiter i.e. nothing. The third
string is between the 2nd and 3rd delimiters. The 4th string is between the 3rd
and 4th delimiters, again nothing. The final string is what appears after the
final delimiter, nothing.
"I saw a string that wasn't there,
It wasn't there again today
O how I wish that string would go away"