正在加载图片...
5.字符串截取类函数 (1) CString Left( int n Count)const Left函数提取字符串对象最开始(左侧)的若干字符, 将所提取子串的拷贝作为返回值。截取字符的数量由参数 n Count决定,当 n count大于字符串长度时,整个字符串被提 取。操作后,原始字符串未发生变化 (2)CString Right( int nCount)const 与Lef函数调用类似, Righti函数调用提取字符串右侧( 末尾)的若干字符。 (3) CString Mid( int n First)const CString Mid( int nFirst, int n Count)const Mid函数调用从字符串对象中间开始提取子串,开始位置 由 nFirst参数指定,提取字符数由参数 n Count指定,当省略 参数 n Count,表示从 n First开始,提取余下的所有字符 CString sl(abcdef") CString S2=S Mid( 2, 3);//s2="cde5.字符串截取类函数 (1)CString Left( int nCount ) const; Left函数提取字符串对象最开始(左侧)的若干字符, 将所提取子串的拷贝作为返回值。截取字符的数量由参数 nCount决定,当nCount大于字符串长度时,整个字符串被提 取。操作后,原始字符串未发生变化。 (2)CString Right( int nCount ) const; 与Left函数调用类似,Right函数调用提取字符串右侧( 末尾)的若干字符。 (3)CString Mid( int nFirst ) const; CString Mid( int nFirst, int nCount ) const; Mid函数调用从字符串对象中间开始提取子串,开始位置 由nFirst参数指定,提取字符数由参数nCount指定,当省略 参数nCount,表示从nFirst开始,提取余下的所有字符。 CString s1( "abcdef" ); CString s2= s.Mid( 2,3 ); // s2= "cde
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有