tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
isxdigit.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2020 Tobias Hienzsch
3
4#ifndef TETL_CCTYPE_ISXDIGIT_HPP
5#define TETL_CCTYPE_ISXDIGIT_HPP
6
7namespace etl {
8/// \brief Checks if the given character is a hexadecimal numeric character
9/// (0123456789abcdefABCDEF).
10///
11/// \param ch Character to classify.
12///
13/// \returns Non-zero value if the character is a hexadecimal numeric character,
14/// zero otherwise.
15///
16/// https://en.cppreference.com/w/cpp/string/byte/isxdigit
17///
18/// \ingroup cctype
19[[nodiscard]] constexpr auto isxdigit(int ch) noexcept -> int
20{
21 auto const isDigit = ch >= '0' and ch <= '9';
22 auto const isHexLower = ch >= 'a' and ch <= 'f';
23 auto const isHexUpper = ch >= 'A' and ch <= 'F';
24
25 return static_cast<int>(isDigit or isHexLower or isHexUpper);
26}
27} // namespace etl
28
29#endif // TETL_CCTYPE_ISXDIGIT_HPP
constexpr auto isxdigit(int ch) noexcept -> int
Checks if the given character is a hexadecimal numeric character (0123456789abcdefABCDEF).
Definition isxdigit.hpp:19
Definition adjacent_find.hpp:9