Trim

 

 

 

Trim

 

Description

Removes all leading and trailing occurrences of either whitespace or specified characters.

 

Arguments

1.Trim - 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 beginning or end of the string.  Trimming characters are case sensitive.  If not supplied, only the whitespace will be trimmed from the string.

 

Examples

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

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

 

<Trim|     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 beginning and end because no whitespace appears in the characters to remove.

 

<Trim|A sentence that starts with an a.|a>

Returns "A sentence that starts with an a." because the a is case sensitive.

 

<Trim|A sentence that starts with an a.|A >

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

 

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

Returns "A 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 beginning or 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.