find | |||||||||||||
Type | command | ||||||||||||
Dictionary | LCS | ||||||||||||
Library | LiveCode Script | ||||||||||||
Syntax |
| ||||||||||||
Summary | Searches the fields of the current stack. | ||||||||||||
Introduced | 1.0 | ||||||||||||
OS | mac, windows, linux, ios, android | ||||||||||||
Platforms | desktop, server, mobile | ||||||||||||
Parameters |
| ||||||||||||
Example |
| ||||||||||||
Values |
| ||||||||||||
Related | Property: caseSensitive, dontSearch, mark Command: replace, unmark, sort, mark Control Structure: function Keyword: normal, whole, characters, string, character, the, words, word, card, field Constant: return Object: field, stack, card Glossary: property, current card, reset, return, container, function, command, current stack Function: foundChunk, foundField, offset, matchText, foundText, foundLine, foundLoc | ||||||||||||
Description | Use the find command to search for text. The find command starts searching after the previously-found text (if there was a previous find command) or at the beginning of the first field on the current card (if not). The six forms of the find command search in different ways. The find normal, find chars, and find words forms search for each word in the textToFind, but the words don't have to be together to be found; they only have to all appear on the same card. The find words and find wholeforms look for complete words only. The find string and find whole forms search for the textToFind as a unit. The find normal form looks for each word in the textToFind at the beginning of a word. For example, find "ring bell" finds "ringing" and "belltower", but not "bring" or "Campbell". All the words you specify must be in fields on the card, but they don't need to be in the same order, or even in the same field. The find chars form looks for each word in the textToFind, in any part of a word. Unlike the find normal form, the find chars form doesn't require that the words in the textToFind be found at the start of a word on the card. For example, find chars "ring bell" finds "bring", "ringing", "belltower", and "Campbell". As with the find normal form, all the words must be somewhere on the card, but they don't need to be in the same order, or in the same field. The find words form looks for each word in the textToFind. All the words must be complete words, not parts of words. For example, find words "ring bell" finds "ring" and "bell", but not "ringing", "bring", "belltower", or "Campbell". As with the find normal and find chars forms, all the words must be somewhere on the card, but they don't need to be in the same order, or in the same field. The find string form looks for the entire textToFind as a unit. Unlike the find normal, find chars, and find words forms, the find string form requires that the textToFind be found exactly: the words must be in the same order and in the same field, and not separated by other words. For example, find string "ring bell" finds "ring bell" and "bring belltower", but not "ring the bell" (extra word between "ring" and "bell" ), "Ringbell Street" (no space between "ring" and "bell" ), or "bell ringer" (words are in the wrong order). The find whole form looks for the entire textToFind as a unit. Like the find words form (and unlike the find string form), the find whole form requires that each word in the textToFind be found as a whole word, not part of a word. For example, find whole "ring bell" finds "ring bell", but not "bring belltower" (the "ring" and "bell" are parts of words, not whole words), "ring the bell" (extra word between "ring" and "bell" ), "Ringbell Street" (no space between "ring" and "bell" ), or "bell ringer" (words are in the wrong order).
The find empty form of the find command removes the box from the last word found and resets the find command, so that the next search starts from the beginning of the current card, rather than the location of the next find. Going to another card also resets the find command. The setting of the caseSensitive property determines whether the search considers uppercase and lowercase characters to be equivalent.
Usually, the offset and matchText functions are faster than the find command. But unlike these functions, the find command can search all the fields of a stack at once, instead of one container at a time.
| ||||||||||||
Tags | database |