A candidate token matches a search token if it begins with that string (e.g. If all search tokens can be matched, return true otherwise return false. The algorithm is relatively simple: check each search token matches a token in the candidate string. The match method is where the real work is done. These tokens will be needed each time a test is made on a candidate string to see if the candidate string matches the search text. The matcher object’s initialiser splits the search text into separate tokens, delimited by whitespace. Pseudocode for using the search algorithm In the sample project the SF symbol names (with periods replaced by spaces) are searched each time the search bar contents changes. The method returns a boolean value indicating whether the candidate string matched the search text or not. That object will have a method which takes a candidate string as a parameter (the data item to test for a match, a space-separated SF Symbol name in the sample app). Using the algorithm will require a matcher object to be initialised with the search text.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |