IOS String Search Method Daquan

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.