tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
iscntrl.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_ISCNTRL_HPP
5#define TETL_CCTYPE_ISCNTRL_HPP
6
7namespace etl {
8
9/// \brief Checks if the given character is a control character as classified by
10/// the currently installed C locale. In the default, "C" locale, the control
11/// characters are the characters with the codes 0x00-0x1F and 0x7F.
12///
13/// \param ch Character to classify.
14///
15/// \returns Non-zero value if the character is a control character, zero
16/// otherwise.
17///
18/// https://en.cppreference.com/w/cpp/string/byte/iscntrl
19///
20/// \ingroup cctype
21[[nodiscard]] constexpr auto iscntrl(int ch) noexcept -> int
22{
23 return static_cast<int>((ch >= 0x00 and ch <= 0x1f) or ch == 0x7F);
24}
25
26} // namespace etl
27
28#endif // TETL_CCTYPE_ISCNTRL_HPP
constexpr auto iscntrl(int ch) noexcept -> int
Checks if the given character is a control character as classified by the currently installed C local...
Definition iscntrl.hpp:21
Definition adjacent_find.hpp:9