Trim - Function SummarySummary:Removes whitespace from a string. Default removes from head and tail. Usage:trim series Arguments:series - The series argument. (must be: series port) Refinements:/head - Removes only from the head. /tail - Removes only from the tail. /auto - Auto indents lines relative to first line. /lines - Removes all line breaks and extra spaces. /all - Removes all whitespace. /with - The with refinement. str - Same as /all, but removes characters in 'str'. (must be: char string) Description:The default for TRIM is to remove whitespace characters (tabs and spaces) from the heads and tails of every line of a string.
When a string includes multiple lines, the head and tail whitespace will be trimmed from each line (but not within the line):
The final line terminator is preserved. Note that TRIM modifies the string in the process.
TRIM does not copy the string. If that's what you want, then use TRIM with COPY to copy the string before trimming it. Several refinements to TRIM are available. To trim just the head and/or tail of a string you can use the /HEAD or /TAIL refinements.
When using /HEAD or /TAIL, multiple lines are not affected:
To trim just the head and tail of a multiline string, but none of its internal spacing:
If you use TRIM/LINES then all lines and extra spaces will be removed from the text. This is useful for word wrapping and web page kinds of applications.
You can also remove /ALL space:
One of the most useful TRIM refinements is /AUTO which will do a "smart" trim of the indentation of text lines. This mode detects the indentation from the first line and preserves indentation for the lines to follow:
This is useful for sections of text that are embedded within code and indented to the level of the code. To trim other characters, the /WITH refinement is provided. It takes an additional string that specifies what characters to be removed.
Related:clear - Removes all values from the current index to the tail. Returns at tail.
| ||||||||||||||
|