How do I check if a string contains another string in Swift?

后端 未结 27 3799
天命终不由人
天命终不由人 2020-11-22 12:32

In Objective-C the code to check for a substring in an NSString is:

NSString *string = @\"hello Swift\";
NSRange textRange =[strin         


        
27条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 13:08

    Swift 3: Here you can see my smart search extension fro string that let you make a search on string for seeing if it contains, or maybe to filter a collection based on a search text.

    https://github.com/magonicolas/Swift-Smart-String-Search

提交回复
热议问题