antiFilter ( textToFilter ; filterAllow ; filterSubChar ; start ; stop ; textBuilt )
replace any character not specified in the allowed list with the substitute character
Average rating: 4.4 (35 votes) Log in to vote
Michael Rauch ShopWorks http://www.shopworx.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
The impetus for the custom function was to have a way to override FileMaker's built in word separators when using LeftWords (and other word evaluation functions). This tail recursive function will build a new string, substituting any non-allowed characters with the substitute character.
A call would look something like this...
Let(
[
textToFilter = TO::someField;
filterAllow = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
]
;
cf_AntiFilter (textToFilter ; filterAllow ; " " ; 1 ; Length (textToFilter) ; "")
)
Comments
pixi, berlin May 5, 2012 |
||
wouldn't it be shorter to have it: ============================== Case ( start < ( Length ( textToFilter ) + 1 ); Let([ charToSub = Middle ( textToFilter; start; 1); textBuilt = Case ( IsEmpty ( Filter ( charToSub; filterAllow )); filterSubChar; charToSub ) ]; textBuilt ) & antiFilter ( textToFilter; filterAllow; filterSubChar; start + 1 ) ) ============================== pixi |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.