.net - string.Compare 行为

标签 .net string localization string-comparison

这怎么可能? (这取自VS2008中的即时窗口)

?string.Compare("-", "+")
-1
?string.Compare("-0", "+0")
1

最佳答案

来自 String.Compare 的评论(强调我的):

The comparison uses the current culture to obtain culture-specific information such as casing rules and the alphabetic order of individual characters. For example, a culture could specify that certain combinations of characters be treated as a single character, or uppercase and lowercase characters be compared in a particular way, or that the sorting order of a character depends on the characters that precede or follow it.

关于.net - string.Compare 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1873701/

相关文章:

c# - 在 Fluent NHibernate 自动映射中自引用多对多关系自动映射到 1 :n and not n:n

.net - 统计一个字符在一个字符串中出现的次数?

c# - 你如何在 C# 中使用 XMLSerialize 枚举类型的属性?

.net - Control.Invoke 是否发送消息?

c# - Visual Studio 中的本地化文件路径

c++ - 将 char 转换为 std::string,然后连接

string - Shell 脚本三元运算符获取字符串结果

javascript - 用于仅匹配和替换 excel 公式字符串中的列号数字的正则表达式

ios - 如何将 rtl 支持添加到我的 ios 应用程序

string - 如果 String 是 'alphabetically growing' ,如何检查 Scala ?