可是都會忘....
Return Value
The index of the last character in this CString object that matches the requested character; –1 if the character is not found.
Parameters
ch
The character to search for.
Remarks
Searches this CStringstrrchr. object for the last match of a substring. The function is similar to the run-time function
Example
// Example for CString::ReverseFind
CString s( "abcabc" );
ASSERT( s.ReverseFind( 'b') == 4 );
這是msdn上的解釋
我每次再回來看都是有點看不懂
所以我又上網找了一下別人的解釋
原來有一個跟ReverseFind 類似的字串符搜尋api 就是Find
CString str = "abcdbc";
int x1 = str.Find('b');
int x2 = str.ReverseFind('b');
x2 = 4;
x1 = 1;
後來我終於知道他們的差異在哪 T_T
Find 是找第一個'b'
ReverseFind 是找最後一個'b'
沒有留言:
張貼留言