In C#, it is well known that \".\".CompareTo(\"A\") == -1
.
My question is: is there a punctuation mark x such that x.CompareTo(\"A\") == 1
You should simply use character with code you like (i.e. character '\uffcc'
or string "\uffcc"
) as sentinel as long as you don't need to make it printable.
Character comparison uses Unicode (UTF-16) character codes. So look at Unicode table to find some like:
'A' < '{' or 'A' < '¡'.
String comparison: there are no "<" and ">" operators in String class. You need to use Compare method. Usually you use StringComparer class to pick what type of comparison you want case sensitive, culture aware or just by Unicode values.
Unicode type of characters impact default comparison used by CompareTo (when not using compare ordinal). Character with category "OtherLetter" is greater than character with category "OtherSymbol" or "OtherPunctuation" (Char.GetUnicodeCategory). See CompareOptions.StringSort for details.