TrimStart

 

 

 

TrimStart

 

Description

Removes all leading occurrences of either whitespace or specified characters.

 

Arguments

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

 

Examples

[TrimStart|     A sentence with 5 leading and trailing spaces.     ]

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

 

[TrimStart|     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 because no whitespace appears in the characters to remove.

 

[TrimStart|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.

 

[TrimStart|A sentence that starts and ends with the letter a|A ]

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

 

[TrimStart|abcdefgA sentence that starts and ends with 7 letters of the alphabet.abcdefg|gfedcba]

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

 

Notes

If at any point after removing any characters from the beginning 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.