Skip to content

Commit 60782bb

Browse files
committed
#8 - Implement method CppStringT::capitalize()
Completed.
1 parent 9fb272f commit 60782bb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cpp-strings/cppstrings.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ class CppStringT : public std::basic_string<CharT>
108108

109109
//=== Methods =========================================
110110

111+
//--- capitalize() ------------------------------------
112+
// /** \brief In-place modifies the string with its first character capitalized and the rest lowercased. Returns a reference to the string*/
113+
inline CppStringT& capitalize() noexcept
114+
{
115+
this->lower();
116+
(*this)[0] = upper((*this)[0]);
117+
return *this;
118+
}
119+
120+
111121
//--- is_punctuation() --------------------------------
112122
/** \brief Returns true if the string contains only one character and if this character belongs to the ASCII punctuation set. */
113123
inline const bool is_punctuation() const noexcept

0 commit comments

Comments
 (0)