String search is mainly used to filter, filter, and query the search function of UITableView.
Here are some popular search query methods
I. Traversal search
For loop
On request: Exact search (interpretation of string equality) fuzzy search (string inclusions)
Related knowledge points
Search for substrings in a string
NSString *STR1 = @ "Can you stest speak 中文版"; NSString *str = @ "stest";//Search Stest in str1 this string to infer if there is no if ([str1 rangeofstring:str].location! = nsnotfound) { NSLog (@ " This string has Stest ");} Rangeofstring the preceding reference is the string to be searched, followed by the character to be searched//nsnotfound represents something that the request operation or item is not found, or does not exist
Two. Predicate Search
(Some search methods written with the Nspredicate class are faster than for loops and have a low performance consumption.) )
OC Learning---predicate (nspredicate)
Nspredicate predicate summary array filtering fuzzy matching
third-party libraries
Searchcoretest
A contact search library, supported by the search methods include: User name kanji, pinyin and fuzzy search, number search, the most important is to support T9 search, great.
Utpinyinhelper
By pinyin to match the Chinese characters, simply speaking, is the pinyin search
IOS String Search Method Daquan