str trim
for strings
Trim whitespace or specific character.
Signature
> str trim {flags} ...rest
Flags
-
--char, -c {string}
: character to trim (default: whitespace) -
--left, -l
: trims characters only from the beginning of the string -
--right, -r
: trims characters only from the end of the string
Parameters
-
...rest
: For a data structure input, trim strings at the given cell paths
Input/output types:
input | output |
---|---|
list<string> | list<string> |
record | record |
string | string |
table | table |
Examples
Trim whitespace
> 'Rsh shell ' | str trim
Rsh shell
Trim a specific character
> '=== Rsh shell ===' | str trim --char '=' | str trim
Rsh shell
Trim whitespace from the beginning of string
> ' Rsh shell ' | str trim --left
Rsh shell
Trim a specific character
> '=== Rsh shell ===' | str trim --char '='
Rsh shell
Trim whitespace from the end of string
> ' Rsh shell ' | str trim --right
Rsh shell
Trim a specific character
> '=== Rsh shell ===' | str trim --right --char '='
=== Rsh shell