tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
towupper.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_TOWUPPER_HPP
5#define TETL_CWCTYPE_TOWUPPER_HPP
6
7#include <etl/_cwchar/wint_t.hpp>
8#include <etl/_cwctype/iswlower.hpp>
9
10namespace etl {
11
12/// \brief Converts the given wide character to uppercase, 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/towupper
18///
19/// \ingroup cwctype
20[[nodiscard]] constexpr auto towupper(wint_t ch) noexcept -> wint_t
21{
22 if (iswlower(ch) != 0) {
23 return ch - wint_t(32);
24 }
25 return ch;
26}
27} // namespace etl
28
29#endif // TETL_CWCTYPE_TOWUPPER_HPP
constexpr auto iswlower(wint_t ch) noexcept -> int
Checks if the given wide character is a lowercase letter, i.e. one of abcdefghijklmnopqrstuvwxyz or a...
Definition iswlower.hpp:21
constexpr auto towupper(wint_t ch) noexcept -> wint_t
Converts the given wide character to uppercase, if possible.
Definition towupper.hpp:20
Definition adjacent_find.hpp:9