By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,963 Members | 1,749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,963 IT Pros & Developers. It's quick & easy.

Case insensitive search of substring in wide char

P: n/a
How can I find the wheather the occurance substring is main string in
wide char provided that the compasion should be case insensitive.

Nov 14 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
aj***********@gmail.com wrote:
How can I find the wheather the occurance substring is main string in
wide char provided that the compasion should be case insensitive.


Assumption: Your question is "How can I find out whether a wide char
substring occurs in some wide char string under the condition that
the comparison should be case insensitive?"
Answer: "You cannot reliably."

Even if you use towupper() from <wctype.h> on every wide character
of both strings (such that they are now "upper case" strings) then
you can still have the situation that for
wint_t a, b, c, d;
there holds
(towlower(a) == towlower(b)) && (towlower(b) == c)
but
(a!=b) && (a!=c) && (b!=c)
and
d == towupper(c)
where it is open whether d compares equal to a, b or none of them.

However, if there is a one-on-one mapping of upper and lower case
letters, you can use towupper() as described above in combination
with some string search algorithm.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.