Will return the starting position of a text string within another text string. This function is not case sensitive.
Search([FindText], [WithinText], [StartNumber])
Where:
FindText is a string of text to be found.
WithinText is the string within which FindText is to be located.
StartNumber is the number of the character within the WithinText string, where the search is to begin.
This function searches the WithinText string for the first occurrence encountered of the FindText string, from the StartNumber value.
If no value is entered for the StartNumber, then the search begins with the first character of the WithinText string.
If no occurrence of the FindText string is found, then a null value is returned. Otherwise, the number of the first character of the occurrence is returned.
Rule | Meaning |
---|---|
Search("Hello", "And I said Hello to them", 1) | Searches the string "And I said Hello to them" for the first occurrence of the string "Hello". The search runs from the first character in the WithinText string, which is the letter 'A'. The number of the starting character of the occurrence is 12. |
Search("Hello", "And I said Hello to them and they said Hello back", 13) | Searches the string "And I said Hello to them and they said Hello back" for the first occurrence of the string "Hello". The search runs from the thirteenth character in the WithinText string, which is the letter 'e'. The number of the starting character of the occurrence is 40. |
Search("Hello", "And I said ello to them", 1) | Searches the string "And I said ello to them" for the first occurrence of the string "Hello". The search runs from the first character in the WithinText string, which is the letter 'A'. No occurrence is found, so a null value is returned. |