FirstMatchIndex ( values ; string )
Returns the index of the first value that contains the search string.
Average rating: 4.0 (25 votes) Log in to vote
Richard Dyce - Show more from this author
Dyce & Sons Ltd. http://dyce.com |
FirstMatchIndex ( "abc¶023¶abc¶def¶123¶def"; "XYZ")
0
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
A quick function to return the index of the first value in 'values' that contains the search 'string'. If the string isn't found returns 0.
Comments
comment, VR Feb 26, 2016 |
||
FirstMatchIndex ( "Alfred¶Betty¶Fred¶George" ; "Fred" ) returns 1 instead of the expected 3. This is because you're not testing for the position of the string *as a value*. Try instead: ValueCount ( Left ( values ; Position ( ¶ & values & ¶ ; ¶ & string & ¶ ; 1 ; 1 ) ) ) (from: http://www.briandunning.com/cf/908) |
||
Richard Dyce, Dyce & Sons Ltd. Mar 25, 2020 |
||
Err, no. If that's what you want, try https://www.briandunning.com/cf/2342 or https://www.briandunning.com/cf/2342 ; This function specifically is looking for a partial match. Returning 1 is precisely what "first value in 'values' that contains the search 'string'" is meant to mean - hence the 'contains'. ;-) | ||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.