TrimAll_CR ( )

Function stats

Average user rating
391
350
9999
Support
FileMaker 7.0 +
Date posted
25 February 2013
Version
1
Recursive function
Yes

Author Info
 menno

4 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

TrimAll_CR  ( Text )


Parameters

Text  A text with carriage-returns leading, trailing and/or between the lines that must be removed


Description

Tags:  Text   Format  

All redundant returns will be removed. The lines or paragraphs separated by more than one ¶ will be separated by just one ¶.

This functions is very similar to the Trim_CR()-function. The only difference is that Trim_CR() lacks the first line in the case()-statement

Examples

Sample input

TrimAll_CR ( "

This text will be cleansed from the ¶ at the beginning
and at the end. In the same way as the Trim() function
works for leading and trailing spaces.

Extra ¶ characters between the lines in the rest of the text
are also removed.

" )


Sample output

This text will be cleansed from the ¶ at the beginning
and at the end. In the same way as the Trim() function
works for leading and trailing spaces.
Extra ¶ characters between the lines in the rest of the text
are also removed.

 

Function code

// ####################
// ## Trim_CR function
// ##
// ## Author:
// ## Menno van Beek - STB Automatisering & Advies BV -
// ## Houten, the Netherlands
// ##
// ## Format:
// ## Trim_CR ( Text )
// ##
// ## Parameters:
// ## Text - Textstring with carriage-returns leading,
// ## trailing and/or between values
// ##
// ## Data type returned:
// ## text
// ##
// ## Description:
// ## All redundant returns: leading, trailing and the extra
// ## returns between values will be removed
// ##
// ## July 31, 2012
// ####################

Case (
PatternCount ( Text ; "¶¶" ) ; TrimAll_CR ( Substitute ( Text ; [ "¶¶" ; ¶ ] ) ) ;
Left ( Text ; 1 ) = ¶ ; Trim_CR ( Right ( Text ; Length ( Text ) - 1 ) ) ;
Right ( Text ; 1 ) = ¶ ; Trim_CR ( Left ( Text ; Length ( Text ) - 1 ) ) ;
Text )

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/350

    Prototype: TrimAll_CR( Text )
    Function Author: menno (http://www.fmfunctions.com/mid/391)
    Last updated: 25 February 2013
    Version: 1

*/
// ===================================

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)