Does anyone know a method to make case-insensitive comparing of two char symbols? I don't want to use .ToUpper()
or To.Lower()
, I want to compare them like strings String.Compare("abc", "ABC", CompareOptions.OrdinalIgnoreCase);
Asked
Active
Viewed 68 times
0

Cœur
- 37,241
- 25
- 195
- 267

Aliaksei Futryn
- 461
- 5
- 8
-
1Maybe use `.ToString()` and here you go? – Rafalon May 14 '18 at 09:17
-
1Why you don't want to use `ToUpper`? – Tim Schmelter May 14 '18 at 09:18
-
See [Jon Skeet's answer](https://stackoverflow.com/a/1394898/7831383) to this (maybe duplicate) [question](https://stackoverflow.com/questions/1394877/what-is-the-correct-way-to-compare-char-ignoring-case) – Rafalon May 14 '18 at 09:21
-
@Rafalon: already closed because of that duplicate ;-) – Tim Schmelter May 14 '18 at 09:24
-
Thank you, I've got all the information from the link of duplicated question. I can use ToUpper, I just want to know if it is possible or not to use CompareOptions while I'm comparing symbols. – Aliaksei Futryn May 14 '18 at 09:25
-
@TimSchmelter aye right, I didn't refresh the page. @AliakseiFutryn if you'd read the entire answer, you'd see there's a variant with `.ToString()` that uses `StringComparison.InvariantCultureIgnoreCase` – Rafalon May 14 '18 at 09:27
-
@TimSchmelter yes, I see, thank you. – Aliaksei Futryn May 14 '18 at 09:30