if ( bFromRight )
{
// find last non-space character
- iterator psz = begin() + length() - 1;
- while ( wxSafeIsspace(*psz) && (psz >= begin()) )
- psz--;
-
+ reverse_iterator psz = rbegin();
+ while ( (psz != rend()) && wxSafeIsspace(*psz) )
+ psz++;
+
// truncate at trailing space start
- *++psz = wxT('\0');
- erase(psz, end());
+ erase(psz.base(), end());
}
else
{
// find first non-space character
iterator psz = begin();
- while ( wxSafeIsspace(*psz) )
+ while ( (psz != end()) && wxSafeIsspace(*psz) )
psz++;
// fix up data and length