add wxString::Capitalize() and MakeCapitalized() for consistency with Upper/Lower() we already have

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-08-01 23:39:11 +00:00
parent 4b7d829b21
commit 0c7db140c5
5 changed files with 87 additions and 34 deletions

View File

@@ -1363,6 +1363,20 @@ wxString& wxString::MakeLower()
return *this;
}
wxString& wxString::MakeCapitalized()
{
const iterator en = end();
iterator it = begin();
if ( it != en )
{
*it = (wxChar)wxToupper(*it);
for ( ++it; it != en; ++it )
*it = (wxChar)wxTolower(*it);
}
return *this;
}
// ---------------------------------------------------------------------------
// trimming and padding
// ---------------------------------------------------------------------------
@@ -1967,13 +1981,6 @@ int wxString::Freq(wxUniChar ch) const
return count;
}
// convert to upper case, return the copy of the string
wxString wxString::Upper() const
{ wxString s(*this); return s.MakeUpper(); }
// convert to lower case, return the copy of the string
wxString wxString::Lower() const { wxString s(*this); return s.MakeLower(); }
// ----------------------------------------------------------------------------
// wxUTF8StringBuffer
// ----------------------------------------------------------------------------