Brian Dunning's FileMaker Custom Functions

RemoveExtraReturns ( Text )

Removes duplicate carriage returns from text.

  Average rating: 4.1 (39 votes) Log in to vote

Andrew Persons   Andrew Persons
Excelisys
http://www.excelisys.com/

Share on Facebook Share on Twitter

  Sample input:
RemoveExtraReturns ( "Hello
my

name is

Andy" )
  Sample output:
Hello
my
name is
Andy

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

Removes duplicate carriage returns from text. Single carriage returns are preserved, but multiple or superfluous carriage returns are boiled down to a single carriage return.

 

Comments

Avaya   Avaya, Bhubaneswar
Sep 10, 2013
Yes, this is a good one.
We may delete/replace the first and last carrriage return of a text/string.

I'm wondering how to delete the multiple carriage return from anywhere of the string/text. So I think it is the best custom function for this.

Thanks for sharing...
 
RealGrouchy   RealGrouchy
Oct 12, 2018
The first Left () function refers to "text" instead of "Text".

- RG>
 
Philip Wang   Philip Wang, 106th Street Wheel and Tire
Dec 13, 2022
Can be further simpler like this:
Custom Function: RemoveEmptyLines
Parameter: Text
Definition:

Case (
PatternCount (text ; "¶¶" ) > 0; RemoveEmptyLines ( Substitute ( Text ; "¶¶" ; "¶" ) ) ;
Left(Text;1) = "¶"; RemoveEmptyLines( Right( Text; Length(Text) -1 ) ) ;
Right(Text;1) = "¶"; RemoveEmptyLines( Left( Text; Length(Text) - 1) ) ;
Text
)
 

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: