CString类常用的几个函数

来源:互联网 发布:java父类调用子类方法 编辑:程序博客网 时间:2024/06/04 00:12

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)