问题描述
从来到这个问题我不知道为什么 A
和 AE
是不同的(这是有道理的),但 SS
和 SS
视为相等。我还没有找到一个答案所以即使this问题似乎是相关的,甚至提到的的 SS
将相当于 SS
的德国,或类似的,但不知其所以然。
我发现MSDN上的唯一资源是这样的:如何:比较字符串
下面提及以下,而且缺乏的为什么的:
//他们跳舞在大街上。
//在语言(在Windows),SS等于
//德国essetz:'SS'在这两个EN-US和去DE的文化性格。
.....
那么,为什么这个计算结果为真
,都与去DE
文化或其他文化:
变种CI =新的CultureInfo(去DE);
INT结果= ci.CompareInfo.Compare(大街,大街,CompareOptions.IgnoreNonSpace); // 0
布尔等于= String.Equals(大街,大街,StringComparison.CurrentCulture); // 真正
等于= String.Equals(大街,大街,StringComparison.InvariantCulture); // 真正
如果你看一下Ä页面中,你会发现并不总是一个是一个替代自动曝光(AE或),而且还在各种语言的使用。
信 SS 来代替:
因此,SS采用的是一个单一的语言,用一个单一的规则(SS = = SS),而A采用的是多语言,多条规则。
需要注意的是,考虑到情况下折叠是:
该负责人统一code 7.0 案例耐折性能告诉我们,
其中,00DF是SS和0073是S,所以SS可以考虑的,对于无壳比较,因为SS。
Coming from this question I'm wondering why ä
and ae
are different(which makes sense) but ß
and ss
are treated as equal. I haven't found an answer on SO even if this question seems to be related and even mentions "that ß
will compare equal to SS
in Germany, or similar" but not why.
The only resource on MSDN I found was this: How to: Compare Strings
Here is mentioned following but also lacks the why:
// "They dance in the street."
// Linguistically (in Windows), "ss" is equal to
// the German essetz: 'ß' character in both en-US and de-DE cultures.
.....
So why does this evaluate to true
, both with de-DE
culture or any other culture:
var ci = new CultureInfo("de-DE");
int result = ci.CompareInfo.Compare("strasse", "straße", CompareOptions.IgnoreNonSpace); // 0
bool equals = String.Equals("strasse", "straße", StringComparison.CurrentCulture); // true
equals = String.Equals("strasse", "straße", StringComparison.InvariantCulture); // true
If you look at the Ä page, you'll see that not always Ä is a replacement for Æ (or ae), and it is still used in various languages.
The letter ß instead:
So the ß is used in a single language, with a single rule (ß == ss), while the Ä is used in multiple languages with multiple rules.
Note that, considering that case folding is:
The official Unicode 7.0 Case Folding Properties tells us that
where 00DF is ß and 0073 is s, so ß can be considered, for caseless comparison, as ss.
这篇关于为什么" SS"等于德锐的性格'SS'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!