So I want to be able do split this string by spaces: "1 ½ cups fat-free half-and-half, divided "
I wrote my code like this:
String trimmed;
String[] words = trimmed.split(" ");
But it doesn't work! The 1 and the ½ end up in the same position of the array.
I also tried How to split a string with any whitespace chars as delimiters but it does not split string either. Looking in text editor there is clearly some sort of "space" but I don't get how to split on it. Is is because of "½"?