CString 字符串截取_函数
CString res;
CString str = _T("abcdefghijklmn");
res = str.Mid(2,3); //从第3位字母开始,共取3个字符
ASSERT(res == _T("cde"));
res = str.Left(3); //从左边数起,共取3个字符
ASSERT(res == _T("abc"));
res = str.Right(3); //从右边数起,共取3个字符
ASSERT(res == _T("lmn"));
res = str.SpanIncluding(_T("edcba")); //遇到参数里没有的字符即停下,返回停下之前的字符串
ASSERT(res == _T("abcde"));
res = str.SpanExcluding(_T("fgb")); //遇到参数里面有的字符即停下,返回停下之前的字符串
ASSERT(res == _T("a"));
posted on 2013-12-09 13:05 fantiejun0436 阅读(428) 评论(0) 编辑 收藏 举报