最終更新日時:
が更新

履歴 編集

function
<locale>

std::ctype::scan_is

const charT* scan_is(mask m, const charT* low, const charT* high) const; // (1) C++98

概要

文字列中の、指定した分類に該当する最初の文字を取得する。

戻り値

do_scan_is(m, low, high)

#include <iostream>
#include <locale>

int main()
{
  const auto& ct = std::use_facet<std::ctype<char>>(std::locale::classic());

  const char s[] = "ab1c";

  // 最初の数字の位置を得る
  const char* p = ct.scan_is(std::ctype_base::digit, s, s + 4);

  std::cout << (p - s) << std::endl;
}

出力

2

バージョン

言語

  • C++98

関連項目