TrimEnd

 

 

 

TrimEnd

 

Description

Removes all trailing occurrences of either whitespace or specified characters.

 

Arguments

1.TrimEnd - Name of the Macro.

2.Trim String - The string that will be used for trimming.

3.Trimming Characters - A string where each of its characters will be used to trim any instances of those characters at the end of the string.  Trimming characters are case sensitive.  If not supplied, only the whitespace will be trimmed from the string.

 

Examples

<TrimEnd|     A sentence with 5 leading and trailing spaces.     >

Returns "     A sentence with 5 leading and trailing spaces." with no spaces at the end.

 

<TrimEnd|     A sentence with 5 leading and trailing spaces.     |A>

Returns "     A sentence with 5 leading and trailing spaces.     " with all of the whitespace at the end because no whitespace appears in the characters to remove.

 

<TrimEnd|A sentence that starts and ends with the letter a|a >

Returns "A sentence that starts and ends with the letter" because both the a and spaces were removed.

 

<TrimEnd|A sentence that starts and ends with the letter a|A >

Returns "A sentence that starts and ends with the letter a" because the A is case sensitive.

 

<TrimEnd|abcdefgA sentence that starts and ends with 7 letters of the alphabet.abcdefg|gfedcba>

Returns "abcdefgA sentence that starts and ends with 7 letters of the alphabet." because all of the letters were listed in the trimming characters list.

 

Notes

If at any point after removing any characters from the end of the string one of the supplied characters appears, it will be removed.  The order of the supplied characters does not matter.

 


Copyright © 2024 pasUNITY, Inc.

 

Send comments on this topic.