Brian Dunning's FileMaker Custom Functions

NormaliseSpace ( string ; removeReturns )

Text function to reduce all multiple spaces and returns

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

Tim Mansour   Tim Mansour

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.

Under construction. Email me your wish list for improvements.