ctype::scan_not

找出第一個字元不符合指定的遮罩的範圍。

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

參數

  • maskVal
    比對字元的遮罩值。

  • first
    第一個字元的指標會掃描的範圍。

  • last
    對應至字元的指標在要掃描的範圍中的最後一個字元之後。

傳回值

第一個字元的指標在不符合指定的遮罩的範圍。如果這個值不存在,則函式會傳回 last。

備註

成員函式傳回 do_scan_not(maskVal、 first, last)。

範例

// ctype_scan_not.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_not
      ( ctype_base::alpha, string, string + strlen(string) );
   cout << "First nonalpha character is \"" << *i << "\" at position: " 
      << i - string << endl;
}
  

需求

標題: <locale>

命名空間: std

請參閱

參考

ctype Class