How to compare two case insensitive strings?

前端 未结 5 361
鱼传尺愫
鱼传尺愫 2021-01-12 17:00

i have 2 string objects containing same string but case is different,now i wanna compare them ignoring the case sensitivity,how to do that??here is the code...



        
5条回答
  •  生来不讨喜
    2021-01-12 17:32

    Just use lowercaseString on both of the strings and then compare them as you would using a normal string equality check. It will still be O(n) so no big deal.

提交回复
热议问题