Brian Dunning's FileMaker Custom Functions

TextClean ( someText ; options )

Returns the text, stripped of leading/trailing whitespace and removing specified text/font formatting.

  Be the first to rate this function Log in to vote

Dan Shockley   Dan Shockley - Show more from this author

  Sample input:
TextClean ( "Hello World!¶ ¶" ; "ALLOW_ALL_FORMAT" )
  Sample output:
"Hello World!"

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

Returns the text, stripped of leading/trailing whitespace and removing specified text/font formatting.
The 'options' param can be:
SIMPLE OPTIONs:
- ALLOW_ALL_FORMAT - Include in options to retain all text formatting (only clean up whitespace and NULL).
- ALLOW_COLOR - Include in options to retain font colors.
- ALLOW_FONT - Include in options to retain font faces. WARNING: this will usually block style removal!!
- ALLOW_SIZE - Include in options to retain font sizes.
- ALLOW_STYLES_ALL - Include in options to retain all font styles (but still remove color/face/size).
- ALLOW_STYLES_BY_NUM_# - Include in options to retain specified styles.
Append a number by adding the FM constants (e.g. Italic + Bold)
See constants at: https://help.claris.com/en/pro-help/content/textstyleremove.html

WARNING: if you use ALLOW_FONT, that will usually (always?) prevent this function from removing Italic and Bold styles (and possibly Condensed et al - anything with a font-face), since FileMaker usually does that kind of styling by silently/secretly changing the font-face.

REQUIRES:
SuperTrim, by Debi Fuchs: https://www.briandunning.com/cf/904

 

Comments

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 22 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: