CString strSrc = _T("1++2+3+4");
CStringArray strResult;

CString strGap = _T("+");
int nPos = strSrc.Find(strGap);

CString strLeft = _T("");
while(0 <= nPos)
{
    strLeft = strSrc.Left(nPos);
    if (!strLeft.IsEmpty())
        strResult.Add(strLeft);

    strSrc = strSrc.Right(strSrc.GetLength() - nPos - 1);
    nPos = strSrc.Find(strGap);
}

if (!strSrc.IsEmpty()) {
   strResult.Add(strSrc);
}

int nSize = strResult.GetSize();
for (int i = 0; i < nSize; i++)
{
    OutputDebugString(strResult.GetAt(i) + _T("\n"));
}

 

相关文章:

  • 2021-09-04
  • 2021-12-10
  • 2022-02-11
猜你喜欢
  • 2022-01-27
  • 2022-12-23
  • 2022-01-27
  • 2021-11-26
  • 2022-01-25
  • 2021-10-24
  • 2022-12-23
相关资源
相似解决方案