fix After{First,Last}() to work for strings with non-ASCII characters in UTF-8 build and added unit tests for this

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-09-29 12:08:44 +00:00
parent b74134f61d
commit c565abe1c5
2 changed files with 27 additions and 3 deletions

View File

@@ -1285,7 +1285,7 @@ wxString wxString::AfterLast(wxUniChar ch) const
if ( iPos == wxNOT_FOUND )
str = *this;
else
str = wx_str() + iPos + 1;
str.assign(*this, iPos + 1, npos);
return str;
}
@@ -1308,7 +1308,8 @@ wxString wxString::Left(size_t nCount) const
wxString wxString::BeforeFirst(wxUniChar ch) const
{
int iPos = Find(ch);
if ( iPos == wxNOT_FOUND ) iPos = length();
if ( iPos == wxNOT_FOUND )
iPos = length();
return wxString(*this, 0, iPos);
}
@@ -1331,7 +1332,7 @@ wxString wxString::AfterFirst(wxUniChar ch) const
wxString str;
int iPos = Find(ch);
if ( iPos != wxNOT_FOUND )
str = wx_str() + iPos + 1;
str.assign(*this, iPos + 1, npos);
return str;
}