Look at these examples:
[code]StringArray tokens;
tokens.addTokens(T(“two words”), false);
// tokens.size() is 2 (correct!)
tokens.clear();
tokens.addTokens(T("five words with trailing space "), false);
// tokens.size() is 6 (incorrect!)
tokens.clear();
tokens.addTokens(T("six words with two trailing spaces "), false);
// tokens.size() is 8 (incorrect!)
tokens.clear();
tokens.addTokens(T(" five words with leading space"), false);
// tokens.size() is 6 (incorrect!)
tokens.clear();
tokens.addTokens(T(“seven words with three spaces in middle”), false);
// tokens.size() is 9 (incorrect!)
[/code]
I don’t think we want leading, trailing, and multiple spaces included when tokenizing, do we?
It’s easily handled with a call to StringArray::removeEmptyStrings(true) when tokenizing whitespace, but not as easily remedied when tokenizing with other break characters.