General Utility Library for C++17 25.4.1
case_ascii.h
Go to the documentation of this file.
1
24#ifndef GUL17_CASE_ASCII_H_
25#define GUL17_CASE_ASCII_H_
26
27#include <string_view>
28#include <string>
29
30#include "gul17/internal.h"
31
32namespace gul17 {
33
48constexpr char lowercase_ascii(char c) noexcept
49{
50 if (c >= 'A' && c <= 'Z')
51 c = static_cast<char>(c + ('a' - 'A'));
52 return c;
53}
54
63GUL_EXPORT
64std::string lowercase_ascii(std::string_view str);
65
76GUL_EXPORT
77std::string& lowercase_ascii_inplace(std::string& str) noexcept;
78
87constexpr char uppercase_ascii(char c) noexcept
88{
89 if (c >= 'a' && c <= 'z')
90 c = static_cast<char>(c - ('a' - 'A'));
91 return c;
92}
93
102GUL_EXPORT
103std::string uppercase_ascii(std::string_view str);
104
115GUL_EXPORT
116std::string& uppercase_ascii_inplace(std::string& str) noexcept;
117
119
120} // namespace gul17
121
122#endif
123
124/* vim:set expandtab softtabstop=4 tabstop=4 shiftwidth=4 textwidth=90 cindent: */
auto constexpr bit_set(unsigned bit) noexcept -> ReturnT
Set a bit in an integral type.
Definition bit_manip.h:121
GUL_EXPORT std::string & uppercase_ascii_inplace(std::string &str) noexcept
Replace all ASCII characters in a string by their uppercase equivalents.
Definition case_ascii.cc:59
GUL_EXPORT std::string & lowercase_ascii_inplace(std::string &str) noexcept
Replace all ASCII characters in a string by their lowercase equivalents.
Definition case_ascii.cc:40
constexpr char lowercase_ascii(char c) noexcept
Return the ASCII lowercase equivalent of the given character (or the unchanged character,...
Definition case_ascii.h:48
constexpr char uppercase_ascii(char c) noexcept
Return the ASCII uppercase equivalent of the given character (or the unchanged character,...
Definition case_ascii.h:87
Definition of macros used internally by GUL.
Namespace gul17 contains all functions and classes of the General Utility Library.
Definition doxygen.h:26