String.IndexOf() and NewLine '\n' #49586
-
Really basic yet interesting question for me. Why does the following code return -1 when running on EN-US culture? I would expect it to find the newline character and return index 1.
Of course this is bad practice and we should be specifying StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase. However, I genuinely don't understand why this doesn't work without specifying the StringComparison. Note that the following work just fine:
|
Beta Was this translation helpful? Give feedback.
Answered by
stephentoub
Mar 14, 2021
Replies: 1 comment 1 reply
-
See #43736 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
robloo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See #43736