trim, trim all, vtrim, vtrim all
Trims excess white spaces (including tabs, new line symbols and other invisible control characters) from the beginning and end of the string.
trim trims excessive spaces from beginning and ends, but leave spaces inside the string untouched.
trim all also removes redundant white blanks inside the string and replaces them by single spaces. I.e. new line symbols are also replaced by spaces.
Non-break space symbols are not affected.
Vectorization: The function names beginning with the prefix v support vectorization in the 1st function parameter.
Instead of providing a single value, you can provide a set or even a nested set which contain multiple values.
The function will then process every value and its return value contains a corresponding set containing all results.
Note:For these functions, you need add the prefix letter 'v' in front of the function name. Otherwise
the function recognizes a set and attempts to process sets and not strings.
See trim [set function] for the corresponding set function.
Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter
1
No. | Type | Description |
---|---|---|
1 input |
valid types | input string or value(s) Attention: If 1st parameter is a set:
|
Type | Description |
---|---|
string set |
trimmed string(s) Excess white spaces removed according to function chosen. If vectorization has been applied, then the results are inside (nested) sets. |
echo( '"', trim ( " This is a green cat "), '"' );
echo( '"', trim all( " This is a green cat "), '"' );
"This is a green cat"
"This is a green cat"