GetValueIndex ( valueList ; valueString ; matchCase ; occurrence )
Return index to value in valuelist. Search case sensitive or insensitive. Search for occurrence from front or end.
Average rating: 3.9 (51 votes) Log in to vote
Lewis Lorenz - Show more from this author
Lorenz Companies http://www.LorenzCom.com |
GetValueIndex ( "Alpha¶Bravo¶Charlie¶Echo" ; "charlie" ; True ; 1 )
GetValueIndex ( "James¶Bill¶James¶Frank¶James¶Ed" ; "james" ; False ; -2 )
0
3
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
GetValueIndex (valueList, valueString, matchCase, occurrence)
by Lewis C. Lorenz.
9/20/2011 Created
9/22/2011 Modified.
Retrieve the index of the matching valueString in the valueList.
Returns 0 if not found.
Optionally toggle case-sensitive searching by passing a boolean through matchCase.
Optionally search for specific valueString occurrence (a negative occurrence number causes backward search from the end of the valueList).
NOTICE: While this function is optimized to be single-pass when possible, this is a recursive function; so, if you change the function name remember to also change it in the function code.
Examples:
GetValueIndex ( "Alpha¶Bravo¶Charlie¶Echo" ; "charlie" ; False ; 1 ) = 3
GetValueIndex ( "Alpha¶Bravo¶Charlie¶Echo" ; "charlie" ; True ; 1 ) = 0
GetValueIndex ( "James¶Bill¶James¶Frank¶James¶Ed" ; "james" ; False ; -2 ) = 3
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.