Example #1
0
void SplitString(const wstring &srcString, WStringArray &destStrings)
{
	destStrings.clear();
	wstring s;
	size_t len = srcString.length();
	if (len == 0)
		return;
	for (size_t i = 0; i < len; i++) {
		wchar_t c = srcString[i];
		if (c == L' ') {
			if (!s.empty())	{
				destStrings.push_back(s);
				s.clear();
			}
		}
		else
			s += c;
	}
	if (!s.empty())
		destStrings.push_back(s);
}