tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
isalpha.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_ISALPHA_HPP
5#define TETL_CCTYPE_ISALPHA_HPP
6
7namespace etl {
8/// \brief Checks if the given character is an alphabetic character as
9/// classified by the default C locale.
10///
11/// \param ch Character to classify.
12///
13/// \returns Non-zero value if the character is an alphabetic character, 0
14/// otherwise.
15///
16/// https://en.cppreference.com/w/cpp/string/byte/isalpha
17///
18/// \ingroup cctype
19[[nodiscard]] constexpr auto isalpha(int ch) noexcept -> int
20{
21 auto const isLower = ch >= 'a' and ch <= 'z';
22 auto const isUpper = ch >= 'A' and ch <= 'Z';
23
24 return static_cast<int>(isLower or isUpper);
25}
26} // namespace etl
27
28#endif // TETL_CCTYPE_ISALPHA_HPP
constexpr auto isalpha(int ch) noexcept -> int
Checks if the given character is an alphabetic character as classified by the default C locale.
Definition isalpha.hpp:19
Definition adjacent_find.hpp:9