# 2.2.3.15.37 string::SpanIncluding

## Description

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

## Syntax

string SpanIncluding( LPCSTR lpszCharSet )

## Parameters

lpszCharSet
[input] A string interpreted as a set of characters.

## Return

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.

## Examples

EX1

void string_SpanIncluding_ex1()
{
string str1("1,2,3 abc");
string str2=str1.SpanIncluding("0123456789,");
printf("the string left is \"%s\"\n", str2);
//Should print"1,2,3" since these charactors are also included in "0123456789,"

string str3=str1.SpanIncluding("abc");
printf("the string left is \"%s\"\n", str3);
//Should print"" since there is no charactor which is also in "0123456789,"
}

## Remark

This member function extracts 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.