Case insensitive comparison NSString

后端 未结 12 1635
滥情空心
滥情空心 2020-12-12 13:15

Can anyone point me to any resources about case insensitive comparison in Objective C? It doesn\'t seem to have an equivalent method to str1.equalsIgnoreCase(str2)

12条回答
  •  生来不讨喜
    2020-12-12 13:51

    Converting Jason Coco's answer to Swift for the profoundly lazy :)

    if ("Some String" .caseInsensitiveCompare("some string") == .OrderedSame)
    {
      // Strings are equal.
    }
    

提交回复
热议问题