fish-shell/doc_src/cmds/string-trim.rst
Fabian Boehm c625a324ba
Some checks failed
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
docs/string-trim: Double down on the set of chars vs string thing
2024-11-25 17:53:14 +01:00

45 lines
1020 B
ReStructuredText

string-trim - remove trailing whitespace
========================================
Synopsis
--------
.. BEGIN SYNOPSIS
.. synopsis::
string trim [-l | --left] [-r | --right] [(-c | --chars) CHARS]
[-q | --quiet] [STRING ...]
.. END SYNOPSIS
Description
-----------
.. BEGIN DESCRIPTION
``string trim`` removes leading and trailing whitespace from each *STRING*. If **-l** or **--left** is given, only leading whitespace is removed. If **-r** or **--right** is given, only trailing whitespace is trimmed.
The **-c** or **--chars** switch causes the set of characters in *CHARS* to be removed instead of whitespace. This is a set of characters, not a string - if you pass ``-c foo``, it will remove any "f" or "o", not just "foo" as a whole.
Exit status: 0 if at least one character was trimmed, or 1 otherwise.
.. END DESCRIPTION
Examples
--------
.. BEGIN EXAMPLES
::
>_ string trim ' abc '
abc
>_ string trim --right --chars=yz xyzzy zany
x
zan
.. END EXAMPLES