General Utility Library for C++14  2.7
case_ascii.h
Go to the documentation of this file.
1 
24 #ifndef GUL14_CASE_ASCII_H_
25 #define GUL14_CASE_ASCII_H_
26 
27 #include <string>
28 #include "gul14/internal.h"
29 #include "gul14/string_view.h"
30 
31 namespace gul14 {
32 
41 constexpr char lowercase_ascii(char c) noexcept
42 {
43  if (c >= 'A' && c <= 'Z')
44  return c - 'A' + 'a';
45  else
46  return c;
47 }
48 
57 GUL_EXPORT
58 std::string lowercase_ascii(gul14::string_view str);
59 
70 GUL_EXPORT
71 std::string &lowercase_ascii_inplace(std::string &str) noexcept;
72 
81 constexpr char uppercase_ascii(char c) noexcept
82 {
83  if (c >= 'a' && c <= 'z')
84  return c - 'a' + 'A';
85  else
86  return c;
87 }
88 
97 GUL_EXPORT
98 std::string uppercase_ascii(gul14::string_view str);
99 
110 GUL_EXPORT
111 std::string &uppercase_ascii_inplace(std::string &str) noexcept;
112 
113 } // namespace gul14
114 
115 #endif
116 
117 /* vim:set expandtab softtabstop=4 tabstop=4 shiftwidth=4 textwidth=90 cindent: */
gul14::basic_string_view
A view to a contiguous sequence of chars or char-like objects.
Definition: string_view.h:107
gul14::uppercase_ascii_inplace
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
gul14::lowercase_ascii_inplace
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
string_view.h
Provides a gul14::string_view that is fully compatible with C++17's std::string_view.
internal.h
Definition of macros used internally by GUL.
gul14
Namespace gul14 contains all functions and classes of the General Utility Library.
Definition: doxygen.h:26
gul14::lowercase_ascii
constexpr char lowercase_ascii(char c) noexcept
Return the ASCII lowercase equivalent of the given character (or the unchanged character,...
Definition: case_ascii.h:41
case_ascii.h
Declarations of lowercase_ascii(), lowercase_ascii_inplace(), uppercase_ascii(), and uppercase_ascii_...
gul14::uppercase_ascii
constexpr char uppercase_ascii(char c) noexcept
Return the ASCII uppercase equivalent of the given character (or the unchanged character,...
Definition: case_ascii.h:81