I was fiddling around with parsing in C# and found that for every string I tried, string.StartsWith("\u2D2D")
will return true. Why is that?
It seems it works with every char. Tried this code with .Net 4.5 the Debugger did not break.
for (char i = char.MinValue; i < char.MaxValue; i++)
{
if(!i.ToString().StartsWith("\u2d2d"))
{
Debugger.Break();
}
}
I think I'll have a try.
From what I get, is that U+2D2D was added in Unicode v6.1 (source / source).
The .NET framework, or the native calls rather, support a lower version:
Thus it is required to mark it as an ignorable character, which behaves just as if the character wasn't even there.
Example:
string.StartsWith
uses a similar implementation, but usesCompareInfo.IsPrefix(string, string, CompareOptions)
instead.