CString::ReverseFind()和CString::Find()区别
CString::ReverseFind()和CString::Find()区别
Find()是从左往右查找;ReverseFind()是从右边往左查找,但是他们返回的地址都是从左往右数的。
示例:
[cpp]#include “stdafx.h”
#include “afx.h”
int main(int argc, char* argv[])
{
CString str = “abcdabcd”;
int a = str.Find(‘b’);
int b = str.ReverseFind(‘b’);
printf(“a=%d,b=%d\n”,a,b);
return 0;
}[/cpp]
OutPut:a=1,b=5