[wx-dev] Re: case insensitive find() in wxString
Gunnar Roth
gunnar.roth at gmx.de
Wed Aug 2 07:04:44 PDT 2006
> I was going to propose a patch for these too :)
> I.e. in my SoC project I'm currently doing a LOT of times things like:
>
creating a function would mean doing this only one time...
> wxArrayString arr = ...
> wxString str;
> for (size_t i=0; i < max; i++)
> str += arr[i] + wxT(",");
> if (str.EndsWith(wxT(",")))
> str.RemoveLast();
A "nice" example for inefficient wxString coding.
This should be much faster:
wxArrayString arr = ...
wxString str;
if(max == 0) return;
avglen= //wild guess
str.Alloc(max* (avglen + 1));
for (size_t i=0; i < max - 1; i++)
str << arr[i] << wxT(",");
str << arr[max-1];
i was just in the mood of criticizing some code, sorry ;-)
regards,
gunnar
More information about the wx-dev
mailing list