void ClassName::stringSplit(CStringArray & outStringArray, CString inputString, CString seperator)
{
int index = 0;
int indexStart = 0;
int seperatorLen = seperator.GetLength();
do
{
index = inputString.Find(seperator,
indexStart);
if (index !=
-1)
{
// means found
//TRACE(_T("%s:%d,
index:%d\n"), __FUNCTIONW__, __LINE__, index);
outStringArray.Add(inputString.Mid(indexStart,
index - indexStart));
indexStart
= index + seperatorLen;
}
} while (index != -1);
// last part
outStringArray.Add(inputString.Mid(indexStart,
inputString.GetLength()));
}
沒有留言:
張貼留言