FIND
The FIND function looks for one text string within another text string and returns to its starting position, if found.
- Syntax:
FIND (single-text-expression , single-text-expression
[ , single-number-expression ] )- Meaning:
- FIND (text_to_find, where_to_look[ , position_to_start_the_search ] )
- Returns:
- A single integer
FIND returns the starting position of the text item specified by text_to_find within the text item specified by where_to_look. A third argument (position_to_start_the_search) can be used to specify the location in where_to_look for the FIND to begin. Bytes in the text are numbered from left to right, with the leftmost byte being position 1.
If text_to_find is "none", FIND evaluates to "none".
If a third argument is not used or position_to_start_the_search evaluates to a negative number, it is assumed to be 1. If position_to_start_the_search evaluates to a number greater than the size of where_to_look, FIND evaluates to "none".
If text_to_find is not found in the where_to_look string, FIND evaluates to 0.
Examples
- FIND ("id", "Florida")
Returns the value 5
- FIND ("id", "Florida", 8)
Returns 0 because the 8 (position_to_start_the_search) is greater than the size of where_to_look
- FIND ("\", "mypath",2)
Returns 0 because the string "\" was not found in argument 2
Related functions
- LEFT
- MID
- RIGHT