tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
iswalnum.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_ISWALNUM_HPP
5#define TETL_CWCTYPE_ISWALNUM_HPP
6
7#include <etl/_cwchar/wint_t.hpp>
8
9namespace etl {
10
11/// \brief Checks if the given wide character is an alphanumeric character, i.e.
12/// either a number (0123456789), an uppercase letter
13/// (ABCDEFGHIJKLMNOPQRSTUVWXYZ), a lowercase letter
14/// (abcdefghijklmnopqrstuvwxyz) or any alphanumeric character specific to the
15/// current locale.
16///
17/// \details If the value of ch is neither representable as a wchar_t nor equal
18/// to the value of the macro WEOF, the behavior is undefined.
19///
20/// https://en.cppreference.com/w/cpp/string/wide/iswalnum
21///
22/// \ingroup cwctype
23[[nodiscard]] constexpr auto iswalnum(wint_t ch) noexcept -> int
24{
25 auto isDigit = ch >= L'0' and ch <= L'9';
26 auto isLower = ch >= L'a' and ch <= L'z';
27 auto isUpper = ch >= L'A' and ch <= L'Z';
28 return static_cast<int>(isDigit or isLower or isUpper);
29}
30
31} // namespace etl
32
33#endif // TETL_CWCTYPE_ISWALNUM_HPP
constexpr auto iswalnum(wint_t ch) noexcept -> int
Checks if the given wide character is an alphanumeric character, i.e. either a number (0123456789),...
Definition iswalnum.hpp:23
Definition adjacent_find.hpp:9