Function overview
Prototype
After (
_text; _searchString; _occurrence; _include_bolean )
Parameters
_text
_searchString
_occurrence
_include_bolean
Description
Tags:
text parsing
extracts the end of a text, based on a search string and an occurrence number
occurrence can be positive (starting from the beginning of the text) or negative (starting from the end)
Examples
Sample input
After ( "1234512345" ; "2" ; -1 ; 0 )
Sample output
345
Function code
/*
After ( _text ; _searchString ; _occurrence ; _include_bolean )
by Fabrice Nordmann
v.2.2 Jan 2010
v.2.1 Sept 2007
v.2, Mar 2007
v.1, Jan 2007
v2 adds inclusion boolean parameter.
v2.1 corrects a bug with searchstring
extracts the end of a text, based on a search string and an occurrence number
occurrence can be positive (starting from the beginning of the text) or negative (starting from the end)
e.g. After ( "1234512345" ; "2" ; -1 ; 0 ) = "345"
see also Before, Between, and BetweenNext functions
*/
Let ([
$occurrence = Case ( not GetAsBoolean ( GetAsNumber ( _occurrence )) ; 1 ; GetAsNumber ( _occurrence ))
; $pos = Position ( _text ; _searchString ; Case ( $occurrence < 0 ; Length ( _text ) ; 1 ) ; $occurrence ) + Length ( _searchString ) - 1
];
Right ( _text ;
Length ( _text ) -
$pos + GetAsBoolean ( _include_bolean ) * Length ( _searchString )
)
)
// ===================================
/*
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/83
Prototype: After( _text; _searchString; _occurrence; _include_bolean )
Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
Last updated: 20 January 2010
Version: 1.3
*/
// ===================================
/*__LITBR__After ( _text ; _searchString ; _occurrence ; _include_bolean )__LITBR____LITBR__by Fabrice Nordmann__LITBR__v.2.2 Jan 2010__LITBR__v.2.1 Sept 2007__LITBR__v.2, Mar 2007__LITBR__v.1, Jan 2007__LITBR____LITBR__v2 adds inclusion boolean parameter.__LITBR__v2.1 corrects a bug with searchstring__LITBR____LITBR__extracts the end of a text, based on a search string and an occurrence number__LITBR__occurrence can be positive (starting from the beginning of the text) or negative (starting from the end)__LITBR____LITBR__e.g. After ( "1234512345" ; "2" ; -1 ; 0 ) = "345"__LITBR____LITBR__see also Before, Between, and BetweenNext functions__LITBR__*/__LITBR__Let ([__LITBR__ $occurrence = Case ( not GetAsBoolean ( GetAsNumber ( _occurrence )) ; 1 ; GetAsNumber ( _occurrence ))__LITBR__ ; $pos = Position ( _text ; _searchString ; Case ( $occurrence < 0 ; Length ( _text ) ; 1 ) ; $occurrence ) + Length ( _searchString ) - 1__LITBR__];__LITBR____LITBR__Right ( _text ;__LITBR__Length ( _text ) -__LITBR__$pos + GetAsBoolean ( _include_bolean ) * Length ( _searchString )__LITBR__)__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/83__LITBR____LITBR__ Prototype: After( _text; _searchString; _occurrence; _include_bolean )__LITBR__ Function Author: Fabrice (http://www.fmfunctions.com/mid/37)__LITBR__ Last updated: 20 January 2010__LITBR__ Version: 1.3__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.