tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
towlower.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_TOWLOWER_HPP
5#define TETL_CWCTYPE_TOWLOWER_HPP
6
7#include <etl/_cwchar/wint_t.hpp>
8#include <etl/_cwctype/iswupper.hpp>
9
10namespace etl {
11
12/// \brief Converts the given wide character to lowercase, if possible.
13///
14/// \details If the value of ch is neither representable as a wchar_t nor equal
15/// to the value of the macro WEOF, the behavior is undefined.
16///
17/// https://en.cppreference.com/w/cpp/string/wide/towlower
18///
19/// \ingroup cwctype
20[[nodiscard]] constexpr auto towlower(wint_t ch) noexcept -> wint_t
21{
22 if (iswupper(ch) != 0) {
23 return ch + wint_t(32);
24 }
25 return ch;
26}
27} // namespace etl
28
29#endif // TETL_CWCTYPE_TOWLOWER_HPP
constexpr auto iswupper(wint_t ch) noexcept -> int
Checks if the given wide character is an uppercase letter, i.e. one of ABCDEFGHIJKLMNOPQRSTUVWXYZ or ...
Definition iswupper.hpp:21
constexpr auto towlower(wint_t ch) noexcept -> wint_t
Converts the given wide character to lowercase, if possible.
Definition towlower.hpp:20
Definition adjacent_find.hpp:9