Unexpected behavior with EndsWith

c#

Solution

As mentioned in the comments, the `endswith` Method uses the current Culture, if no StringComparison Type is provided.

You can get it working, by using an ordinal comparission:

`" ".EndsWith(((char)9917).ToString(), StringComparison.Ordinal); //false`

(Ordinal will ultimately compare the `bytes` of the chars to determine equality)

Problem

Can someone explain this behavior? ``` " ".EndsWith(((char)9917).ToString()) // returns true ``` StartsWith works same.

Original source

Related problems