怎样判断一个字符串包含在另外一个字符串里?
VC里有现成的函数么??
两个CHAR[]型的字符串,看看一个是否包含在另外一个里
告诉我一下,万分感谢~~~
[解决办法]
STL:string.find()
MFC:CString.find()
c: strstr
[解决办法]
MFC: CString.find()
[解决办法]
CString string1,string2;
int position;
position=string1.indexOf(string2);
如果string2在string1中找到,则返回string2在string1中位置,否则返回-1。
[解决办法]
CString::Find
int Find( LPCTSTR lpszSub ) const;
Return Value
The zero-based index of the first character in this CString object that matches the requested substring or characters; -1 if the substring or character is not found.