const charT* scan_not (mask m, const charT* low, const charT* high) const;
Return first character not in category
Returns the first character in the range [low,high) that does not classify 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_not, 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 does not belong to any of the categories.
It may be any bitwise combination of the following member enum values:
value | Characteristics |
space | White-space character |
print | Printable character |
cntrl | Control character |
upper | Uppercase letter |
lower | Lowercase letter |
alpha | Alphabetic letter |
digit | Decimal digit |
punct | Punctuation mark |
xdigit | Hexadecimal 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 does not classifies in category m, 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
|
// ctype::scan_not example
#include <iostream>
#include <locale>
using namespace std;
int main ()
{
locale loc;
char period[] = "November2008";
const char * p = use_facet< ctype<char> >(loc).scan_not ( ctype<char>::alpha, period, period+sizeof(period) );
cout << "The first non-alphabetic character is: " << *p << endl;
return 0;
}
|
Output:
The first non-alphabetic character is: 2.
|
See also
ctype::is | Classify characters (public member function) |
ctype::scan_is | Return first character in category (public member function) |
ctype::do_scan_not | Return first character not in category [virtual] (virtual protected member function) |
|