General Utility Library for C++17 26.5.0
case_ascii.h
Go to the documentation of this file.
1
27#ifndef GUL17_CASE_ASCII_H_
28#define GUL17_CASE_ASCII_H_
29
30#include <string_view>
31#include <string>
32
33#include "gul17/internal.h"
34
35namespace gul17 {
36
51constexpr char lowercase_ascii(char c) noexcept
52{
53 if (c >= 'A' && c <= 'Z')
54 c = static_cast<char>(c + ('a' - 'A'));
55 return c;
56}
57
66GUL_EXPORT
67std::string lowercase_ascii(std::string_view str);
68
79GUL_EXPORT
80std::string& lowercase_ascii_inplace(std::string& str) noexcept;
81
90constexpr char uppercase_ascii(char c) noexcept
91{
92 if (c >= 'a' && c <= 'z')
93 c = static_cast<char>(c - ('a' - 'A'));
94 return c;
95}
96
105GUL_EXPORT
106std::string uppercase_ascii(std::string_view str);
107
118GUL_EXPORT
119std::string& uppercase_ascii_inplace(std::string& str) noexcept;
120
122
123} // namespace gul17
124
125#endif
126
127/* 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:124
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:61
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:42
constexpr char lowercase_ascii(char c) noexcept
Return the ASCII lowercase equivalent of the given character (or the unchanged character,...
Definition case_ascii.h:51
constexpr char uppercase_ascii(char c) noexcept
Return the ASCII uppercase equivalent of the given character (or the unchanged character,...
Definition case_ascii.h:90
Definition of macros used internally by GUL.
Namespace gul17 contains all functions and classes of the General Utility Library.
Definition doxygen.h:29