TrimInvalidTrailingChars ( invalidChars ; textToTrim )
Trim given characters if they occur at the tail of a string
Average rating: 4.5 (2 votes) Log in to vote
Benjamin Storrier - Show more from this author
Studio Mondo http://www.studiomondo.com.au |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Ensure specific characters never appear as the last character in a string by trimming them off using this handy function.
- Handles multiple illegal characters given to the function as a string.
- Recursively trims illegal trailing characters until a legal one is found.
Comments
19752, fmc Apr 8, 2018 |
||
It can be non-recursive. Let ( [ ~lastCharIsValid = Right ( Substitute ( textToTrim ; invalidChars ; "" ) ; 1 ) ; ~lastPositionOfValidChar = Position ( textToTrim ; ~lastCharIsValid ; Length ( textToTrim ) ; -1 ) ] ; Case ( ~lastCharIsValid = "" ; "" ; Left ( textToTrim ; ~lastPositionOfValidChar ) ) ) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.