int ExplodeString( const std::wstring& source, const std::wstring& exploder, StringArray& out, int limit)
{
size_t start = 0, end;
int count = 0;
std::wstring::const_iterator b0, b1 = source.begin();
while( b1 != source.end() )
{
end = source.find(exploder, start);
b0 = source.begin() + start;
if( end == std::wstring::npos || (limit>0 && ++count>limit) )
{
b1 = source.end();
}
else
{
b1 = source.begin() + end;
}
out.push_back(std::wstring(b0, b1));
start = end + exploder.length();
}
return out.size();
}