Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I seeing this unexpected behavior from .NET's StartsWith?

Tags:

c#

.net

This must be a .NET bug, right?

"KonNy".StartsWith("Kon") returns false, while "KonNy".StartsWith("Ko") and "KonN".StartsWith("Kon") return true.

Is there anything I'm missing here?

like image 232
ggPeti Avatar asked Jun 16 '12 11:06

ggPeti


1 Answers

Repeated from comments:

I don't know .NET specifically, but I suspected you might observe this phenomenon if StartsWith followed a collation where nny was a single letter, such as Hungarian. If I'm right and if you change your collation to a neutral one, your "bug" would disappear. :)

like image 192
Amadan Avatar answered Sep 22 '22 06:09

Amadan