Brian Dunning's FileMaker Custom Functions

SubstituteCompletely ( text ; searchString ; replaceString )

A better Substitute() function

  Average rating: 4.4 (29 votes) Log in to vote

Peter Wagemans   Peter Wagemans - Show more from this author
Lesterius
https://www.lesterius.com

Share on Facebook Share on Twitter

  Sample input:
Substitute ( "abbbbc"; "bb"; "b")

SubstituteCompletely ( "abbbbc"; "bb"; "b")
  Sample output:
"abbc"

"abc"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function substitutes multiple instances of a search string. Handy for removing excess spaces, returns or tabs from a text.
revision history:
20050511: added "and not PatternCount ( replaceString ; searchString )" to keep the function from going into a loop when the replacement string contains the search string. Thanks to Steven Sanders for pointing that out.

 

Comments

Bill Doerrfeld   Bill Doerrfeld, Seattle
Apr 30, 2009
It would be nice if this function followed the built-in Substitute() function allowing multiple DIFFERENT searching strings to be specified (delimited via brackets).
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.