Make the function more efficient when using UTF-8 wxStrings by using iterators
instead of indices in the loop searching for "&".
Closes #14307.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71434
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
size_t len = in.length();
out.reserve(len);
size_t len = in.length();
out.reserve(len);
- for ( size_t n = 0; n < len; n++ )
+ for ( wxString::const_iterator it = in.begin(); it != in.end(); ++it )
if ( (flags & wxStrip_Mnemonics) && ch == wxT('&') )
{
// skip it, it is used to introduce the accel char (or to quote
// itself in which case it should still be skipped): note that it
// can't be the last character of the string
if ( (flags & wxStrip_Mnemonics) && ch == wxT('&') )
{
// skip it, it is used to introduce the accel char (or to quote
// itself in which case it should still be skipped): note that it
// can't be the last character of the string
+ if ( ++it == in.end() )
{
wxLogDebug(wxT("Invalid menu string '%s'"), in.c_str());
}
else
{
// use the next char instead
{
wxLogDebug(wxT("Invalid menu string '%s'"), in.c_str());
}
else
{
// use the next char instead
}
}
else if ( (flags & wxStrip_Accel) && ch == wxT('\t') )
}
}
else if ( (flags & wxStrip_Accel) && ch == wxT('\t') )