2222
2323// =============================================================
2424#include < algorithm>
25+ #include < cctype>
2526#include < string>
2627#include < vector>
2728// #include <initializer_list>
@@ -107,7 +108,7 @@ class CppStringT : public std::basic_string<CharT>
107108
108109 // === Methods =========================================
109110
110- // --- is_punctuation -- --------------------------------
111+ // --- is_punctuation() --------------------------------
111112 /* * \brief Returns true if the string contains only one character and if this character belongs to the ASCII punctuation set. */
112113 inline const bool is_punctuation () const noexcept
113114 {
@@ -121,7 +122,7 @@ class CppStringT : public std::basic_string<CharT>
121122 }
122123
123124
124- // --- is_space -- --------------------------------------
125+ // --- is_space() --------------------------------------
125126 /* * \brief Returns true if there are only whitespace characters in the string and there is at least one character, or false otherwise.
126127 *
127128 * Notice for version 2.0 of this library: a character is whitespace if
@@ -145,7 +146,7 @@ class CppStringT : public std::basic_string<CharT>
145146 }
146147
147148
148- // --- is_words_sep -- ----------------------------------
149+ // --- is_words_sep() ----------------------------------
149150 /* * \brief Returns true if there are only whitespace and punctuation characters in the string and there is at least one character, or false otherwise. */
150151 inline const bool is_words_sep () const noexcept
151152 {
@@ -159,6 +160,31 @@ class CppStringT : public std::basic_string<CharT>
159160 }
160161
161162
163+ // --- lower () -----------------------------------------
164+ /* * \brief In-place replaces all characters of the string with their lowercase conversion. Returns a reference to string.
165+ *
166+ * Notice: uses the currently set std::locale, which is the "C" one
167+ * by default or any other one as previously set by the user.
168+ */
169+ inline CppStringT& lower () noexcept
170+ {
171+ std::transform (this ->begin (), this ->end (),
172+ this ->begin (),
173+ [](value_type ch) { return this ->lower (ch); });
174+ return *this ;
175+ }
176+
177+ /* * \brief Returns lowercase conversion of the character.
178+ *
179+ * Notice: uses the currently set std::locale, which is the "C" one
180+ * by default or any other one as previously set by the user.
181+ */
182+ static inline const value_type lower (const value_type ch) noexcept
183+ {
184+ return value_type (std::tolower (ch));
185+ }
186+
187+
162188protected:
163189
164190
0 commit comments