Culture sensitive character comparison

  • Thread starter Thread starter Rene
  • Start date Start date
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.
 
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
 
Back
Top