Culture sensitive character comparison

R

Rene

I was wondering if it is possible to compare 2 characters (char) using a
specific culture. I don't really have a need to do this, I am simply curious
about it.

According to me, the documentation appears to say that when two characters
get compared (Char.CompareTo), the system will use the Unicode value (code
point) to compare the two values.

If the above is true, then it is impossible to have 2 characters that mean
the same thing on the .Net framework no matter what culture is active while
comparing.

For me this makes sense since it would be silly to have two characters that
mean the same thing, I mean, what would be the point?

So my questions are:

1) Are there any cultures out there where 2 *characters* mean the same
thing?
2) Is the char.CompareTo comparing just the Unicode (code point)?

Thank you.
 
G

Guest

Rene,

This functionality is built into the String class not Char structure.

char chr1 = 'a';
char chr2 = 'b';

String.Compare(
chr1.ToString(),
chr2.ToString(),
false,
new System.Globalization.CultureInfo("en-GB"));

hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top