I need to tokenize a string where ever there is more than one space.
for instance
"HUNTSVILLE, AL 30 39.8 44.3 52.3"
becomes
"HUNTSVILLE, AL","30","39.8","44.3","52.3"
StringTokenizer st = new StringTokenizer(str, " ");
just tokenizes any whitespace, and I can’t figure out a regex to do what I need.
Thanks
Try this:
The
\smatches any white space char, and{3,}will match it 3 or more times.The snippet above would print: