CString::SpanIncluding

CString SpanIncluding( LPCTSTR lpszCharSet ) const;
  throw( CMemoryException );

返回值:
返回此字符串中的一个子字符串,该子串中的字符也在lpszCharSet字符集中字符集中。该子串开始于字符串中的第一个字符,当发现第一个不是lpszCharSet字符集中的字符时结束。如果字符串中的第一个字符就不是指定字符集中的字符,则SpanIncluding返回一个空的子字符串。

参数:
lpszCharSet一个被解释为字符集的字符串。

说明:
此成员函数用来从字符串中提取字符,提取的子字符串开始于字符串中的第一个字符,其字符都是由lpszCharSet指定的字符集中的。如果字符串的第一个字符就不在此字符集中,则SpanIncluding返回一个空的字符串。否则,它返回一个连续字符序列,它们都是该字符集中的字符。

示例:
下面的例子说明了如何使用CString::SpanIncluding。
// CString::SpanIncluding示例:
CString str( "cabbage" );
CString res = str.SpanIncluding( "abc" );
ASSERT( res == "cabba" );
res = str.SpanIncluding( "xyz" );
ASSERT( res.IsEmpty( ) );

请参阅:CString::SpanExcluding