2个回答
展开全部
CString::Find
int Find( TCHAR ch ) const;
int Find( LPCTSTR lpszSub ) const;
int Find( TCHAR ch, int nStart ) const;
int Find( LPCTSTR pstr, int nStart ) 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.
这是我从MSDN上COPY下来的
意思是说从第nStart个字符开始查找字符ch或字符串pstr。
找到的话返回值是ch在CString这个字符串中的位置
找不到的话返回值-1
zero-based index就是说字符串的第一个字符串对应的nstart是0
比如说
CString test="asdfjkll";
test.find('c')的值是-1
test.find('d')的值是2
…………
int Find( TCHAR ch ) const;
int Find( LPCTSTR lpszSub ) const;
int Find( TCHAR ch, int nStart ) const;
int Find( LPCTSTR pstr, int nStart ) 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.
这是我从MSDN上COPY下来的
意思是说从第nStart个字符开始查找字符ch或字符串pstr。
找到的话返回值是ch在CString这个字符串中的位置
找不到的话返回值-1
zero-based index就是说字符串的第一个字符串对应的nstart是0
比如说
CString test="asdfjkll";
test.find('c')的值是-1
test.find('d')的值是2
…………
展开全部
不是很难的东西,不用翻译了吧,From MSDN:
CString::Find
int Find( TCHAR ch ) const;
int Find( LPCTSTR lpszSub ) const;
int Find( TCHAR ch, int nStart ) const;
int Find( LPCTSTR pstr, int nStart ) 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.
Parameters
ch
A single character to search for.
lpszSub
A substring to search for.
nStart
The index of the character in the string to begin the search with, or 0 to start from the beginning. The character at nStart is excluded from the search if nStart is not equal to 0.
pstr
A pointer to a string to search for.
Remarks
Searches this string for the first match of a substring. The function is overloaded to accept both single characters (similar to the run-time function strchr) and strings (similar to strstr).
Example
// First example demonstrating
// CString::Find ( TCHAR ch )
CString s( "abcdef" );
ASSERT( s.Find( 'c' ) == 2 );
ASSERT( s.Find( "de" ) == 3 );
// Second example demonstrating
// CString::Find( TCHAR ch, int nStart )
CString str("The stars are aligned");
int n = str.Find('e', 5);
ASSERT(n == 12);
CString::Find
int Find( TCHAR ch ) const;
int Find( LPCTSTR lpszSub ) const;
int Find( TCHAR ch, int nStart ) const;
int Find( LPCTSTR pstr, int nStart ) 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.
Parameters
ch
A single character to search for.
lpszSub
A substring to search for.
nStart
The index of the character in the string to begin the search with, or 0 to start from the beginning. The character at nStart is excluded from the search if nStart is not equal to 0.
pstr
A pointer to a string to search for.
Remarks
Searches this string for the first match of a substring. The function is overloaded to accept both single characters (similar to the run-time function strchr) and strings (similar to strstr).
Example
// First example demonstrating
// CString::Find ( TCHAR ch )
CString s( "abcdef" );
ASSERT( s.Find( 'c' ) == 2 );
ASSERT( s.Find( "de" ) == 3 );
// Second example demonstrating
// CString::Find( TCHAR ch, int nStart )
CString str("The stars are aligned");
int n = str.Find('e', 5);
ASSERT(n == 12);
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询