471,078 Members | 825 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,078 software developers and data experts.

Case insensitive search of substring in wide char

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
1 2952
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.

Similar topics

2 posts views Thread by Thomas Philips | last post: by
5 posts views Thread by Nils O. Selåsdal | last post: by
14 posts views Thread by henrik.sorensen | last post: by
11 posts views Thread by Johny | last post: by
1 post views Thread by benhoefer | last post: by
7 posts views Thread by Adrian | last post: by
14 posts views Thread by Mosfet | last post: by
reply views Thread by J. Cliff Dyer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.