1.CString::IsEmpty BOOL IsEmpty( ) const; 返回值:如果CString 对象的长度为0,则返回非零值;否则返回0。 说明:此成员函数用来测试一个CString 对象是否是空的。 示例: 下面的例子说明了如何使用CString::IsEmpty。 // CString::IsEmpty 示例 CString s; ASSERT( s.IsEmpty() ); 请参阅 CString::GetLeng...
s.Empty(); ASSERT( s.GetLength( ) == 0 ); CString::Find int Find( TCHAR ch ) const; int Find( LPCTSTR lpszSub ) const; int Find( TCHAR ch, int nStart ) const; int Find( LPCTSTR lpszSub, int nStart ) const; 返回值 不匹配的话返回 -1; 索引以0 开始 nStar 代表以索引值nStart...
// CString::IsEmpty 示例 CString s; ASSERT( s.IsEmpty() ); 请参阅 CString::GetLength 2.CString::Left CString Left( int nCount ) const; throw( CMemoryException ); 返回值:返回的字符串是前nCount个字符。 示例: CString s( _T("abcdef") ); ASSERT( s.Left(2) == _T("ab") ); ...
// CString::IsEmpty 示例 CString s; ASSERT( s.IsEmpty() ); 请参阅 CString::GetLength CString::Left CString Left( int nCount ) const; throw( CMemoryException ); 返回的字符串是前nCount个字符。 例子 CString s( _T("abcdef") ); ASSERT( s.Left(2) == _T("ab") ); CString::Load...
CString str1,str2,str3; char a; str1 = "nihao"; str2 = "nIhao"; int x; // int i=(str1 == str2); str1.Delete(2,3); 如果nCount(3) > GetCount() – nIndex (5-2)就会执行错误 CString::Empty Void Empty( ); 没有返回值 清空操作; ...
CString str1,str2,str3; char a; str1 = "nihao"; str2 = "nIhao"; int x; // int i=(str1 == str2); str1.Delete(2,3); 如果nCount(3) > GetCount() – nIndex (5-2)就会执行错误 CString::Empty Void Empty( ); 没有返回值 清空操作; ...
第一种,利用系统system函数调用del函数删除文件。 1 CString strTemp; // 记录文件路径及名称2 strTemp.Empty();3 strTemp.Format(_T("del %s"),_T("D:/123.txt"));4 system((CW2A)strTemp); 1. 这种方式有个不好的地方时,会弹出dos的黑框,一闪而过,无法做到无痕迹。
1. CString初始化方法: (1) 直接赋值,如CString str=”杨波”; (2) 通过构造函数初始化,如 CString str(“杨波”); (3) 加载工程中的字符串资源,如CString str;str.LoadString(IDS_STR);IDS_STR是字符串资源的ID (4) 使用CString类的成员函数Format初始化,如CString str; int i=0;double d=23.3434;ch...
1.CString::IsEmptyBOOL IsEmpty( ) const;返回值:如果CString 对象的长度为0,则返回非零值;否则返回0。说明:此成员函数用来测试一个CString 对象是否是空的。2.CString::LeftCString Left( int nCount ) const; throw( CMemoryException );返回值:返回的字符串是前nCount个字符。返回值:如果加载资源成功则...
empty():字符串判空 push_back(c):在字符串末尾添加字符c pop_back:删除字符串末尾字符 find(str, pos):从pos位置开始查找str在原字符串第一次出现的位置 通常底层实现为数组时都有xxx_back操作,因为效率高!不用搬移元素。 string使用 // 初始化charcstring[]="ccc";strings0;// 空串strings1("abc");/...