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