CString::SpanIncluding

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

Return Value

A substring that contains characters in the string that are in lpszCharSet, beginning with the first character in the string and ending when a character is found in the string that is not in lpszCharSet. SpanIncluding returns an empty substring if the first character in the string is not in the specified set.

Parameters

lpszCharSet

A string interpreted as a set of characters.

Remarks

Call this member function to extract characters from the string, starting with the first character, that are in the set of characters identified by lpszCharSet. If the first character of the string is not in the character set, then SpanIncluding returns an empty string. Otherwise, it returns a sequence of consecutive characters which are in the set.

Example

The following example demonstrates the use of CString::SpanIncluding.

// example for CString::SpanIncluding
CString str( "cabbage" );
CString res = str.SpanIncluding( "abc" );
ASSERT( res == "cabba" );
res = str.SpanIncluding( "xyz" );
ASSERT( res.IsEmpty( ) );

CString OverviewClass MembersHierarchy Chart

See Also   CString::SpanExcluding