ValueFromString ( text ; searchString ; start ; occurrence )
Finds a search string within text and returns the value number within which the string is found.
Average rating: 4.6 (23 votes) Log in to vote
"EF" ; 1 ; 1 )
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Finds a search string within text and returns the value number within which the string is found. The search begins from the start position (not the start value) of the text and looks for the specified occurence. Returns 0 if the search string is not found.
The function could be easily modified to start from a given value instead of a position, or to return the value's string rather than value number.
Based on Brian Dunning's PositionValue function, but is useful when you know only a substring of a value within a text rather than the entire value. The function is handy for parsing markup language texts, such as searching for a unique identifier like id="uniqueID" within an HTML page.
Be aware, I tailored this function for my specific purpose and have not given much thought to boundary cases and tricky text strings. Feel free to make this more robust and post suggestions in the comments.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.