This function is used to remove characters in certain classes from one or more fields or from a named variable.
You select which sets of characters can be excluded when performing the function.
- All non alphabetic alphanumeric characters
- Any character which is not an alphabetic character or a digit. Includes the other four exclude options.
- Whitespace
- Spaces and tab characters
- Newline
- Line termination characters. LF (0x1A), VT (0x1B), FF (0x1C), CR (0x1D) and unicode NEL (0x85). Note that other Unicode newline characters may be included in this set.
- Punctuation
- Commas, periods, etc.
- Control
- Characters in the ranges: U+0000 to U+0019, U+001B to U+001F and U+007F to U+009F. Note that while the newline character U+000A (linefeed) and tab U+0009 character are control characters they will not be removed by this set. If you want linefeed characters removed you must also specify the Newline set. If you want tab characters changed to spaces you can specify the Whitespace set and use the Change to option.
You can optionally remove all characters at the start of the field (leading), at the end of the field (trailing) or all characters in the excluded set.
You can also replace all remaining sequences of characters in the excluded set with one space or newline character.
You can also use this function to normalize all newline sequences to the Mac standard of U+000A (linefeed). CRLF and LFCR sequences are converted to a LF character. Any remaining newline characters are converted to a single LF.
Examples:
- Remove all whitespace at the start and end of a field
- Select Whitespace, Remove all Leading and Remove all Trailing
- Remove all whitespace at the start and end of a field and change whitespace sequences to a single space
- Select Whitespace, Remove all Leading, Remove all Trailing and and Change to a single space
- Remove all empty lines
- Select Newline, Remove all Leading, Remove all Trailing and Change to a single newline
- Create a list of words, one per line
- Select All non alphabetic characters, Remove all Leading, Remove all Trailing and Change to a single newline
- Remove all control characters
- Select Control and Remove All
Trimming a named variable is far more efficient than trimming variables when modifying the contents read via an Read Text File function. When in stepwise execution mode and you're trimming a named variable, the function is only performed once. The variable name is constructed at runtime. The supplied name field can contain any of the escape sequences described in Escape Sequences.
When trimming the Comments, Lyrics, Terms of Use, Commercial Information Webpage, Official Artist/Performer Webpage or Rating fields only the default items are modified. If you would like the trim operation to modify all of items for any of these field types, select the Deep option. The option has no effect on other field types or named variables. Note that User Defined Text Info and User Defined URL items will only be trimmed if the deep option is specified.