Cstring -- left, right, find, reversefind
Http://hi.baidu.com/shawmar/item/08b30afb0f32d46f3c1485ec
Cstring -- left, right, find, reversefind
Cstring: Left (intNcount)
-- Returns the ncount character string before the string
Example:
Cstring STR (_ T ("Shop, Workshop "));
STR = Str. Left (4 );
Result: Str = "Shop ";
Cstring: Right (INT ncount)
-- Returns the string of ncount characters after the string
Example:
Cstring STR (_ T ("Shop, Workshop "));
STR = Str. Right (2 );
Result: Str = "Workshop ";
Cstring: Find (_ T (","))
Returns the index value of "," in the string.
Example:
Cstring STR (_ T ("Shop, Workshop "));
Int idex = Str. Find (_ T (","));
At this time: idex = 4;
Zong: to obtain "," content on the right
STR = Str. Right (Str. getlength ()-1-str.find (_ T (",")));
Where:
Str. getlength () = 7;
-1 exclude ","
-Str. Find (_ T (",") exclude all words before ","
Cstring: reversefind
Int reversefind (tchar ch) const;
Return Value:
Returns the index of the last character that matches the required character in the cstring object. If the required character is not found,-1 is returned.
Parameter: the string to be searched.
Note:
This member function searches for the last character that matches a substring in this cstring object. This function is similar to the runtime function strrchr.
Example: // cstring: reversefind example:
Cstring S ("abcabc ");
Assert (S. reversefind ('B') = 4 );