From 9e378480c2b2ccdf5f0da6e11c592bb02d4255fd Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 7 Nov 2018 22:12:55 +0100 Subject: [PATCH] Iterate over all characters of a wxString with iterator --- src/propgrid/propgridiface.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index d5083ecac5..2985d67f75 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -896,15 +896,16 @@ wxPGVIterator wxPropertyGridInterface::GetVIterator( int flags ) const static wxString EscapeDelimiters(const wxString& s) { wxString result; - result.Alloc(s.length()); - const wxChar* ch = s.c_str(); - while (*ch) + result.reserve(s.length()); + + for (wxString::const_iterator it = s.begin(); it != s.end(); ++it) { - if (*ch == wxT(';') || *ch == wxT('|') || *ch == wxT(',')) - result += wxT('\\'); - result += *ch; - ++ch; + wxStringCharType ch = *it; + if ( ch == wxS(';') || ch == wxS('|') || ch == wxS(',') ) + result += wxS('\\'); + result += ch; } + return result; }