You must write your own parser to do this. Assuming that the elements are separated by spaces and all numbers are floating point numbers, this can be done using
strtod()
:
LPCTSTR GetNumberStr(CString& str, LPCTSTR s) const
{
while (*s <= _T(' '))
++s;
LPTSTR lpszEnd;
_tcstod(s, &lpszEnd);
if (*lpszEnd <= _T(' '))
str.SetString(s, static_cast<int>(lpszEnd - s));
else
{
str = _T("");
lpszEnd = _tcschr(s, _T(' '));
}
return lpszEnd;
}
void Parse(CString& strOut, const CString& strIn) const
{
strOut = _T("");
LPCTSTR s = strIn.GetString();
while (s && *s)
{
CString str;
s = GetNumberStr(str, s);
if (!str.IsEmpty())
{
if (!strOut.IsEmpty())
strOut += _T(' ');
strOut += str;
}
}
}