Freigeben über


CStringT::SpanIncluding

Extracts characters from the string, starting with the first character, that are in the set of characters identified by pszCharSet.

CStringT SpanIncluding(
   PCXSTR pszCharSet
) const;

Parameters

  • pszCharSet
    A string interpreted as a set of characters.

Return Value

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

Remarks

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 that are in the set.

Example

// typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;

CAtlString str(_T("cabbage"));
CAtlString res = str.SpanIncluding(_T("abc"));
ASSERT(res == _T("cabba"));
res = str.SpanIncluding(_T("xyz"));
ASSERT(res.IsEmpty());   

Requirements

Header: cstringt.h

See Also

Concepts

CStringT Class

CStringT Members