Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
locale
has_facet
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
locale
tolower
toupper
use_facet
standard facets:
codecvt
codecvt_base
codecvt_byname
collate
collate_byname
ctype
ctype_base
ctype_byname
messages
messages_base
messages_byname
moneypunct
moneypunct_byname
money_base
money_get
money_put
numpunct
numpunct_byname
num_get
num_put
time_base
time_get
time_get_byname
time_put
time_put_byname
ctype
ctype::ctype
public member functions:
ctype::is
ctype::narrow
ctype::scan_is
ctype::scan_not
ctype::tolower
ctype::toupper
ctype::widen
public member types:
ctype::char_type
ctype::mask
protected members:
ctype::do_is
ctype::do_narrow
ctype::do_scan_is
ctype::do_scan_not
ctype::do_tolower
ctype::do_toupper
ctype::do_widen
ctype::~ctype


ctype::scan_is

public member function
const charT* scan_is (mask m, const charT* low, const charT* high) const;

Return first character in category

Returns the first character in the range [low,high) that classifies as conforming to any of the categories specified in m. If no such character is found in the range, high is returned.

During its operation, the version of this function in the generic template simply calls the virtual protected member do_scan_is, which is the member function in charge of performing the actions described above.

Conversely, in the char specialization (ctype<char>), this function uses the internal table to directly return the results.

Parameters

m
Bitmask of member type ctype::mask (inherited from ctype_base) specifying against which category the characters are checked. If the bitmask combines more than one category, the function returns the first character that belongs to any of the categories.
It may be any bitwise combination of the following member enum values:
valueCharacteristics
spaceWhite-space character
printPrintable character
cntrlControl character
upperUppercase letter
lowerLowercase letter
alphaAlphabetic letter
digitDecimal digit
punctPunctuation mark
xdigitHexadecimal character
For a detailed list of the classification of characters of type char, see the reference for cctype.
low, high
Pointer to the initial and final characters of the sequence. The range used is [low,high), which contains all the characters between low and high, including the character pointed by low but not the character pointed by high.
charT is the template parameter of ctype (i.e., the facet's character type).

Return value

A pointer to the first element in the range that classifies, or high if none is found.
charT is the template parameter of ctype (i.e., the facet's character type).

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// ctype::scan_is example
#include <iostream>
#include <locale>
using namespace std;
int main ()
{
  locale loc;
  char quote[] = "Characters do not change. Opinions alter, but characters are only developed.";
               // (quoting Benjamin Disraeli)
  const char * p = use_facet< ctype<char> >(loc).scan_is ( ctype<char>::punct, quote, quote+sizeof(quote) );
  cout << "The second sentence is: " << p << endl;
  return 0;
}


Output:

The second sentence is: . Opinions alter, but characters are only developed.

See also