equals(…) and equalsIgnoreCase(…)

后端 未结 7 913
遇见更好的自我
遇见更好的自我 2021-01-01 19:44

Why do we have equals() and equalsIgnoreCase() as two different methods, when equals() could have been overloaded with a special

7条回答
  •  耶瑟儿~
    2021-01-01 20:04

    I think they just chose one of the alternatives. .NET chose the other. StringComparison.InvariantCultureIgnoreCase etc.

    Definitely what you are suggesting and [even better what] .NET implemented would have been more flexible for different cultures etc. In fact I don't even know what culture they use in this ignore case. I guess Current culture.

提交回复
热议问题