tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
iswxdigit.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_CWCTYPE_ISWXDIGIT_HPP
5#define TETL_CWCTYPE_ISWXDIGIT_HPP
6
7#include <etl/_cwchar/wint_t.hpp>
8
9namespace etl {
10/// \brief Checks if the given wide character corresponds (if narrowed) to a
11/// hexadecimal numeric character, i.e. one of 0123456789abcdefABCDEF.
12///
13/// \details If the value of ch is neither representable as a wchar_t nor equal
14/// to the value of the macro WEOF, the behavior is undefined.
15///
16/// https://en.cppreference.com/w/cpp/string/wide/iswxdigit
17///
18/// \ingroup cwctype
19[[nodiscard]] constexpr auto iswxdigit(wint_t ch) noexcept -> int
20{
21 auto const isDigit = ch >= '0' && ch <= '9';
22 auto const isHexLower = ch >= 'a' && ch <= 'f';
23 auto const isHexUpper = ch >= 'A' && ch <= 'F';
24 return static_cast<int>(isDigit || isHexLower || isHexUpper);
25}
26} // namespace etl
27
28#endif // TETL_CWCTYPE_ISWXDIGIT_HPP
constexpr auto iswxdigit(wint_t ch) noexcept -> int
Checks if the given wide character corresponds (if narrowed) to a hexadecimal numeric character,...
Definition iswxdigit.hpp:19
Definition adjacent_find.hpp:9