Add C++20-style starts_with()/ends_with() functions to wxString

C++20 introduces these two functions, along with some overloads, to
std::string. Add similar functions to wxString, which simply call the
already existing StartsWith() and EndsWith().

Closes https://github.com/wxWidgets/wxWidgets/pull/1452
This commit is contained in:
Lauri Nurmi
2019-07-30 10:01:24 +03:00
committed by Vadim Zeitlin
parent a8c4cbee09
commit 4739b9dedd
3 changed files with 46 additions and 0 deletions

View File

@@ -3255,6 +3255,20 @@ public:
size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
{ return find_last_not_of(sz.data(), nStart, n); }
bool starts_with(const wxString &str) const
{ return StartsWith(str); }
bool starts_with(const char *sz) const
{ return StartsWith(sz); }
bool starts_with(const wchar_t *sz) const
{ return StartsWith(sz); }
bool ends_with(const wxString &str) const
{ return EndsWith(str); }
bool ends_with(const char *sz) const
{ return EndsWith(sz); }
bool ends_with(const wchar_t *sz) const
{ return EndsWith(sz); }
// string += string
wxString& operator+=(const wxString& s)
{