Code symetry for both directions of trimming towards fixing bug #1472688.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1617,19 +1617,18 @@ wxString& wxString::Trim(bool bFromRight)
|
|||||||
if ( bFromRight )
|
if ( bFromRight )
|
||||||
{
|
{
|
||||||
// find last non-space character
|
// find last non-space character
|
||||||
iterator psz = begin() + length() - 1;
|
reverse_iterator psz = rbegin();
|
||||||
while ( wxSafeIsspace(*psz) && (psz >= begin()) )
|
while ( wxSafeIsspace(*psz) && (psz != rend()) )
|
||||||
psz--;
|
psz++;
|
||||||
|
|
||||||
// truncate at trailing space start
|
// truncate at trailing space start
|
||||||
*++psz = wxT('\0');
|
erase(psz.base(), end());
|
||||||
erase(psz, end());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// find first non-space character
|
// find first non-space character
|
||||||
iterator psz = begin();
|
iterator psz = begin();
|
||||||
while ( wxSafeIsspace(*psz) )
|
while ( wxSafeIsspace(*psz) && (psz != end()) )
|
||||||
psz++;
|
psz++;
|
||||||
|
|
||||||
// fix up data and length
|
// fix up data and length
|
||||||
|
Reference in New Issue
Block a user