CString::Remove int CString::Remove( TCHAR ch );Return ValueThe count of characters removed from the string. Zero if the string isn't changed.ParameterschThe character to be removed from a string.ResCall this member function to remove instances of ch from the string. Comparisons for the character are case-sensitive.Example//remove the lower-case letter 't' from a sentence:CString str("This is a test."); int n = str.Remove('t'); ASSERT(n == 2); ASSERT(str == "This is a es.");
CString strBang("Everybody likes ice hockey"); n = strBang.Replace(" ", NULL);
str.Remove(' ');
int CString::Remove( TCHAR ch );Return ValueThe count of characters removed from the string. Zero if the string isn't changed.ParameterschThe character to be removed from a string.ResCall this member function to remove instances of ch from the string. Comparisons for the character are case-sensitive.Example//remove the lower-case letter 't' from a sentence:CString str("This is a test.");
int n = str.Remove('t');
ASSERT(n == 2);
ASSERT(str == "This is a es.");
n = strBang.Replace(" ", NULL);
补充一下,要去掉边上的空格就用:str.TrimRight();str.TrimLeft();