Call this member function to delete a character or characters from a string starting with the character at nIndex. If nCount is longer than the string, the remainder of the string will be removed. 该函数用来删除原对象中从第nIndex+1个字符开始的nCount 个字符。如果nCount比字符串(应该是从第n...
delete是删除 left是取左 如下例子:CString str1,str2;str1 = _T("abcdefg123456");str1.Delete(0,7);//0表示起始位置,7表示要删除的字符数 此时 str1 = _T("123456");str2 = str1.Left(3);//str2 = _T("123"); str1 = _T("123456");
This method deletes a character or characters from a string starting with the character at nIndex. If nCount is longer than the string, the remainder of the string is removed.コピー int Delete( int nIndex , int nCount = 1);
CString删除⼦串 CString str;CString subStr;int index=0;index = str.Find(subStr);//获取⼦串的位置,从开始查找.str.Delete(index, subStr.GetAllocLength());//删除⼦串 实例:获得某个⽂件所在的⽂件夹的路径,使⽤对话框变量获取到⽂件的全路径名,和⽂件名,那么我们就可以得到其所在的⽂...
str1.Delete(2,3); 如果nCount(3) > GetCount() – nIndex (5-2)就会执行错误 22.CString::Empty Void Empty( ); 返回值:没有返回值 清空操作; 示例: CString s( "abc" ); s.Empty(); ASSERT( s.GetLength( ) == 0 ); 23.CString::Find ...
说明:此成员函数用来读取一个由nID标识的Windows字符串资源,并放入一个已有CString对象中。 示例: 下面的例子说明了如何使用CString::LoadString。 // CString::LoadString 示例 #define IDS_FILENOTFOUND 1 CString s; if (! s.LoadString( IDS_FILENOTFOUND )) ...
CString::Delete int Delete( int nIndex, int nCount = 1); 返回值是被删除前的字符串的长度 nIndex是第一个被删除的字符,nCount是一次删除几个字符。根据我实验得出的结果:当nCount>要删除字符串的最大长度(GetCount() -nIndex)时会出错,当nCount过大,没有足够的字符删除时,此函数不执行。
str1.Delete(2,3); 如果nCount(3) > GetCount() – nIndex (5-2)就会执行错误 22.CString::Empty Void Empty( ); 返回值:没有返回值 清空操作; 示例: CString s( "abc" ); s.Empty(); ASSERT( s.GetLength( ) == 0 ); 23.CString::Find ...
example demonstrates the use of CString::Delete.CString str2 = "Hockey is best!";/printf("Before: %s\n", (LPCTSTR) str2);int n = str2.Delete(6, 3);printf("After: %s\n", (LPCTSTR) str2);ASSERT(n == str2.GetLength());//this code generates this line of output:这...
21.CString::Delete int Delete( int nIndex, int nCount = 1); 返回值:是被删除前的字符串的长度 nIndex是第一个被删除的字符,nCount是一次删除几个字符。根据我实验得出的结果:当nCount>要删除字符串的最大长度(GetCount() - nIndex)时会出错,当nCount过大,没有足够的字符删除时,此函数不执行。