Skip to content

[bug / unclear specs] Strings starting with '1' (0x31) are identical to strings starting with '𑁒' (\U00011052) #7876

Answered by huoyaoyuan
Unknown6656 asked this question in General
Discussion options

You must be logged in to vote

The behavior of string operations belongs to dotnet/runtime repo. It's not a part of the language.

It is an inconsistency that Equals defaults to ordinal while StartsWith defaults to culture-aware. Unfortunately, this cannot be easily addressed due to the huge compatibility debt for 25 years. There was discussion about helping this at dotnet/runtime#43956.

Meanwhile, you can use globalization analyzers to help you specify behavior explicitly, or simply check the source code at source.dot.net about the option-less overload. Documentation improvement requests should be sent at dotnet/docs.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Unknown6656
Comment options

Answer selected by Unknown6656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants