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