CString——Left、Right、Find、ReverseFind
来源:互联网 发布:手机mac地址重复 编辑:程序博客网 时间:2024/05/29 16:11
CString::Left(intnCount)
——返回字符串前nCount个字符的字符串
example:
CString str(_T("Shop,车间"));
str = str.Left(4);
结果:str="Shop";
CString::Right(int nCount)
——返回字符串后nCount个字符的字符串
example:
CString str(_T("Shop,车间"));
str = str.Right(2);
结果:str="车间";
CString::Find(_T(","))
返回“,”在字符串中的索引值
example:
CString str(_T("Shop,车间"));
int idex = str.Find(_T(","));
此时:idex=4;
宗:要想获得“,”右侧内容
str = str.Right(str.GetLength()-1-str.Find(_T(",")));
其中:
str.GetLength()=7;
-1排除“,”
-str.Find(_T(","))排除“,”前的所有字
CString::ReverseFind
int ReverseFind( TCHAR ch ) const;
返回值:
返回此CString对象中与要求的字符匹配的最后一个字符的索引;如果没有找到需要的字符则返回-1。
参数: ch 要搜索的字符。
说明:
此成员函数在此CString对象中搜索与一个子串匹配的最后一个字符。此函数类似于运行时函数strrchr。
示例:// CString::ReverseFind示例:
CString s( "abcabc" );
ASSERT( s.ReverseFind( 'b' ) == 4 );
CString::Left(intnCount)
——返回字符串前nCount个字符的字符串
example:
CString str(_T("Shop,车间"));
str = str.Left(4);
结果:str="Shop";
CString::Right(int nCount)
——返回字符串后nCount个字符的字符串
example:
CString str(_T("Shop,车间"));
str = str.Right(2);
结果:str="车间";
CString::Find(_T(","))
返回“,”在字符串中的索引值
example:
CString str(_T("Shop,车间"));
int idex = str.Find(_T(","));
此时:idex=4;
宗:要想获得“,”右侧内容
str = str.Right(str.GetLength()-1-str.Find(_T(",")));
其中:
str.GetLength()=7;
-1排除“,”
-str.Find(_T(","))排除“,”前的所有字
CString::ReverseFind
int ReverseFind( TCHAR ch ) const;
返回值:
返回此CString对象中与要求的字符匹配的最后一个字符的索引;如果没有找到需要的字符则返回-1。
参数: ch 要搜索的字符。
说明:
此成员函数在此CString对象中搜索与一个子串匹配的最后一个字符。此函数类似于运行时函数strrchr。
示例:// CString::ReverseFind示例:
CString s( "abcabc" );
ASSERT( s.ReverseFind( 'b' ) == 4 );
- CString——Left、Right、Find、ReverseFind
- CString——Left、Right、Find、ReverseFind
- CString——Left、Right、Find、ReverseFind
- CString——Left、Right、Find、ReverseFind
- CString——Left、Right、Find、ReverseFind
- CString——Left、Right、Find、Mid、ReverseFind
- CString::Find(),Delete(),Left(),Right(),Mid(),FindOneOf(),ReverseFind()
- CString中Left,Right,ReverseFind 用法
- MFC获取应用程序所在目录--CString(Left、Right、Find、ReverseFind)--Cstring与char或wchar转换
- CString::ReverseFind()和CString::Find()区别
- CString::Left Right
- Left()&ReverseFind()
- CString strExt=filename.Right(filename.GetLength()-filename.ReverseFind('.')-1);
- CString 之 Left(),Mid(),Right()
- CString 之 Left(),Mid(),Right()
- CString中的Right,Left......用法
- C、C++基础知识之 六 CString::ReverseFind()和CString::Find()区别
- CString类常用方法----Left(),Mid(),Right()
- Animation 2D动画笔记
- 周立波暗讽徐峥被指素质着 盘点周立波骂人事件
- 更改LINUX监听端口为20777以及禁止oracle用户登录
- RTSP协议交互过程
- MFC 利用 Codejock XtremeToolkitPro 换肤
- CString——Left、Right、Find、ReverseFind
- myeclipse在线生成注册码
- Linux输入子系统(Input Subsystem)
- DIV+CSS布局
- sshfs建立本机映射(镜像)
- MySQL 数据类型
- windows系统扫盲之--dll动态链接库概念
- IOS系统文件详解
- Topcoder SRM 566 countJourneys