最終更新日時(UTC):
が更新

履歴 編集

function
<cctype>

std::isxdigit

namespace std {
  int isxdigit(int ch);
}

概要

ch が16進数字かどうかを判定する(判定はロケールの影響を受ける)。

戻り値

ch が16進数字と判定されれば非ゼロを、そうでなければゼロを返す。

#include <cctype>
#include <iostream>

int main() {
    std::cout << "isxdigit('A') = " << std::isxdigit('A') << std::endl
              << "isxdigit('a') = " << std::isxdigit('a') << std::endl
              << "isxdigit('Z') = " << std::isxdigit('Z') << std::endl
              << "isxdigit('z') = " << std::isxdigit('z') << std::endl
              << "isxdigit('3') = " << std::isxdigit('3') << std::endl
              << "isxdigit('.') = " << std::isxdigit('.') << std::endl
              << "isxdigit(' ') = " << std::isxdigit(' ') << std::endl
              << "isxdigit('\\n') = " << std::isxdigit('\n') << std::endl
              << "isxdigit('0x0f') = " << std::isxdigit(15) << std::endl;
}

出力例

isxdigit('A') = 4096
isxdigit('a') = 4096
isxdigit('Z') = 0
isxdigit('z') = 0
isxdigit('3') = 4096
isxdigit('.') = 0
isxdigit(' ') = 0
isxdigit('\n') = 0
isxdigit('0x0f') = 0