Function overview
Prototype
TrimSpaceCR (
text )
Parameters
text
Description
Tags:
Text Parsing
remove any leading and trailing " " or "¶"
as an extension of FM function Trim(text)
Examples
Sample input
"
the text
"
Sample output
"the text"
Function code
//remove any leading and trailing " " or "¶"
//as an extension of Trim(text)
Let([
Text = Trim ( Text );
Text = If ( Left ( Text ; 1 ) = "¶" ; Right ( Text ; Length ( text ) - 1 ) ; Text );
Text = If ( Right ( Text ; 1 ) = "¶" ; Left ( Text ; Length ( text ) - 1 ) ; Text );
Text = Trim ( Text );
r = Right ( Text ; 1 ) = "¶" or Left ( Text ; 1 ) = "¶" ];
If ( r ; TrimSpaceCR (Text) ; Text ) //recursion!
)
// ===================================
/*
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/237
Prototype: TrimSpaceCR( text )
Function Author: konrad (http://www.fmfunctions.com/mid/224)
Last updated: 12 December 2009
Version: 1
*/
// ===================================
//remove any leading and trailing " " or "¶"__LITBR__//as an extension of Trim(text)__LITBR____LITBR__Let([__LITBR____LITBR__Text = Trim ( Text );__LITBR__Text = If ( Left ( Text ; 1 ) = "¶" ; Right ( Text ; Length ( text ) - 1 ) ; Text );__LITBR__Text = If ( Right ( Text ; 1 ) = "¶" ; Left ( Text ; Length ( text ) - 1 ) ; Text );__LITBR__Text = Trim ( Text );__LITBR____LITBR__r = Right ( Text ; 1 ) = "¶" or Left ( Text ; 1 ) = "¶" ];__LITBR____LITBR____LITBR__If ( r ; TrimSpaceCR (Text) ; Text ) //recursion!__LITBR__ )__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/237__LITBR____LITBR__ Prototype: TrimSpaceCR( text )__LITBR__ Function Author: konrad (http://www.fmfunctions.com/mid/224)__LITBR__ Last updated: 12 December 2009__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.