[wx-dev] case insensitive find() in wxString
Vadim Zeitlin
vadim at wxwindows.org
Tue Aug 1 17:15:49 PDT 2006
On Tue, 01 Aug 2006 12:24:56 +0200 Francesco Montorsi <f18m_cpp217828 at yahoo.it> wrote:
FM> I'd like to know if you would accept patches which adds a "bool
FM> caseSensitive = true" argument (or rather a "caseCompare cmp = exact"
FM> argument) to the wxString::Find() function.
If we were to do it, I'd rather have something like
enum { Case_Exact, Case_Ignore };
enum { Find_Start = 0, Find_End = 0x8000 };
Find(wxChar ch, int flags = Case_Exact | Find_Start);
i.e. use bit flags instead of the existing boolean parameter as well.
FM> This patch would allow to append the "caseCompare cmp = exact" argument
FM> to various functions (e.g. Contains, Replace, After/Before First/Last,
FM> StartsWith / EndsWith). Specially for wxString::Contains and Replace()
FM> that would be very useful IMO.
...
FM> What's your opinion ?
To be honest, I'm undecided. On one hand, I do see how could this be
useful. OTOH we plan to switch to std::string at some moment in the future
and adding yet more features which the standard class doesn't have is going
to make switching even more difficult. Does the convenience of writing
Find('x', Case_Ignore) instead of find_first_of("xX") really outweigh this?
Regards,
VZ
More information about the wx-dev
mailing list