The Wordpos function returns the word number where a phrase occurs within a string. If the phrase is not located 0 is returned.
result = Wordpos( phrase, string [, |
Note: the words in both the phrase and the string are considered to be separated by single spaces.
say Wordpos( ' your favorite', 'what is your favorite word?' ) -- shows: 3
say Wordpos( 'your favorite', 'what is your favorite word?', 4 ) -- shows: 0
say Wordpos( 'a word or two', 'let us not quibble over a word or two' ) -- shows: 6