scan_is
描述 (Description)
它返回类别中的第一个字符。
声明 (Declaration)
以下是std :: ctype :: scan_is的声明。
C++98
const char_type* scan_is (mask m, const char_type* low, const char_type* high) const;
C++11
const char_type* scan_is (mask m, const char_type* low, const char_type* high) const;
参数 (Parameters)
m - 它是成员类型掩码的位掩码。
low,high - 它是指向字符序列的开头和结尾的指针。
返回值 (Return Value)
它返回指向分类范围中第一个元素的指针,如果没有找到则返回高。
异常 (Exceptions)
Strong guarantee - 如果抛出异常,则没有任何影响。
数据竞争 (Data races)
访问该对象以及[低,高]范围内的元素。
例子 (Example)
在下面的例子中解释了std :: ctype :: scan_is。
#include <iostream>
#include <locale>
int main () {
std::locale loc;
const char quote[] = "iowiki. sairamkrishna, He had developed this tutorial.";
const char * p = std::use_facet< std::ctype<char> >(loc).scan_is
( std::ctype<char>::punct, quote, quote+76 );
std::cout << "The second sentence is: " << p << '\n';
return 0;
}
让我们编译并运行上面的程序,这将产生以下结果 -
The second sentence is: . sairamkrishna, He had developed this tutorial.