且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在.net字符串比较:" + QUOT; VS" - "

更新时间:2021-11-11 20:11:34

还有不一定是一致的字符由字符的排序为任何特定的语言环境。

There isn't necessarily a consistent character-by-character ordering for any particular locale.

MSDN文档

例如,培养可以指定字符的某些组合   被视为单个字符,或大写和小写字符   以特定方式进行比较,或一个字符的排列顺序   依赖于precede或按照它的字符。

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.

,以确保一致的字符逐个字符排序的唯一方法是使用序号比较,这表现在Anton's回答。

The only way to ensure consistent character-by-character ordering is by using an ordinal comparison, as demonstrated in Anton's answer.