Brian Dunning's FileMaker Custom Functions

NormaliseSpace ( string ; removeReturns )

Text function to reduce all multiple spaces and returns

  Average rating: 4.3 (35 votes) Log in to vote

Tim Mansour   Tim Mansour - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
NormaliseSpace ( "  red wine

chicken    thighs

     green olives " , true )
  Sample output:
red wine
chicken thighs
green olives

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

I wrote this originally to clean up user-input text to remove all unnecessary space, but have also found it useful to create consistent value lists.
Cleans up a text field by reducing all multiple spaces and returns; if removeReturns is true it removes all returns by converting them to spaces before all multiple spaces are reduced to single space. Makes use of TrimAll function, and temporarily changes returns to spaces to reduce them. GOTCHA: the function relies on the temporarily-used string §%§ not being used within the text. The temp string must be set to a value that will not occur within in the field if returns are being retained.

 

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