What is the correct way to compare char ignoring case?

前端 未结 9 2514
不知归路
不知归路 2020-12-01 20:31

I\'m wondering what the correct way to compare two characters ignoring case that will work for all cultures. Also, is Comparer.Default the best way

9条回答
  •  天涯浪人
    2020-12-01 21:16

    You can provide last argument as true for caseInsensetive match

    string.Compare(lowerCase, upperCase, true);
    

提交回复
热议问题