How to compare two strings and their upper and lower case signs

后端 未结 5 954
孤独总比滥情好
孤独总比滥情好 2021-02-18 23:47

Let\'s say I have 2 strings.First string is x = \"abc\" and the second one is y = \"ABC\".When I write in c# following code:

if(x == y)

or

5条回答
  •  眼角桃花
    2021-02-19 00:16

    Try:

    Case sensitive:

    String.Equals (a,b)
    

    Case Insensitive

    string.Equals(a, b, StringComparison.CurrentCultureIgnoreCase);
    

提交回复
热议问题