We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

ctype::scan_is

Updated: March 2009

Locates the first character in a range that matches a specified mask.

const CharType *scan_is(
    mask maskVal, 
    const CharType* first, 
    const CharType* last,
) const;

maskVal

The mask value to be matched by a character.

first

A pointer to the first character in the range to be scanned.

last

A pointer to the character immediately following the last character in the range to be scanned.

A pointer to the first character in a range that does match a specified mask. If no such value exists, the function returns last.

The member function returns do_scan_is(maskVal, first, last).

// ctype_scan_is.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
using namespace std;

int main( )   
{
   locale loc1 ( "German_Germany" );
   
   char *string = "Hello, my name is John!";

   const char* i = use_facet<ctype<char> > ( loc1 ).scan_is
      ( ctype_base::punct, string, string + strlen(string) );
   cout << "The first punctuation is \"" << *i << "\" at position: " 
      << i - string << endl;
}
The first punctuation is "," at position: 5

Header: <locale>

Namespace: std

Reference

Other Resources

Date

History

Reason

March 2009

Corrected.

Customer feedback.

Show: