CString類常用的幾個函數

CString strTemp;

 

//去掉最後一個字符

strTemp = strTemp.Left(strTemp.GetLength()-1);

//或

strTemp.SetAt(strTemp.GetLength()-1, 0);

 

 

//字符、字符串替換函數

 

//刪除strTemp中某個字符或字符串

strTemp.Replace('*', '');//strTemp.Remove('*');

strTemp.Replace("123", "");

 

//替換strTemp中的某個字符或字符串

strTemp.Replace('*', '?');

strTemp.Replace("//", "////");//單斜槓替換成雙斜槓

 

此外還有Left,Right,Mid,Find,ReverseFind,MakeLower,MakeUpper,MakeReverse,Delete(nIndex, nCount=1)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章