美文网首页
swift 模糊搜索 不区分大小写

swift 模糊搜索 不区分大小写

作者: MrLSX | 来源:发表于2019-08-21 11:45 被阅读0次
//item是String类型   searchText为搜索内容  对中文不影响
self.searchReultSource = self.dataSource.filter({ (item) -> Bool in
        return item.range(of: searchText, options: .caseInsensitive) != nil)
    })

相关文章

网友评论

      本文标题:swift 模糊搜索 不区分大小写

      本文链接:https://www.haomeiwen.com/subject/bjjbsctx.html