case insensitive find() in wxString
Francesco Montorsi
f18m_cpp217828 at yahoo.it
Wed Aug 2 02:42:25 PDT 2006
Robert Roebling ha scritto:
>>> 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.
>> BTW, why should we switch to std::string in future ?
>
> I'm not in favor of that, either, but it has been a request many
> time already.
sorry - you mean you're not in favour to switch to std::string or to
implement more widely case-insensitive functions support ?
> But what I'm actually wondering is how you handle
> Unicode uppercase. It is easy for a-z, but even Westeuropean
> languages have more letters than these. Is there a native function
> for that or an algorithm etc?
good point. I thought to use wxTolower as all case insensitive wxString
functions currently do... I see that GNU libc does not provide any
stricmp() function unlike e.g. MSVC and probably because for some
Unicode-supported characters the lowercase/uppercase has no sense.
In fact, I see most times wxTolower() is implemented with a call to
tolower() using an explicit cast from wxChar to char.
Probably we should add a note in wxString docs saying that Case_Ignore
flag has sense only for e.g. characters < 127. All other characters
could be considered as "caseless" and thus always compared exactly even
if Case_Ignore is given...
Francesco
More information about the wx-dev
mailing list