fish-shell/doc_src/cmds/string-length.rst
Johannes Altmanninger 30f821c8f4 Fix example in string length docs
Technically the equivalence would be something like

	string length -q $str
	test -n (string join \n -- $str | string collect)

To handle when str has multiple empty strings;
but quoting is easier to remember and enough for most practical purposes.
2020-09-27 21:59:15 +02:00

39 lines
607 B
ReStructuredText

string-length - print string lengths
====================================
Synopsis
--------
.. BEGIN SYNOPSIS
::
string length [(-q | --quiet)] [STRING...]
.. END SYNOPSIS
Description
-----------
.. BEGIN DESCRIPTION
``string length`` reports the length of each string argument in characters. Exit status: 0 if at least one non-empty STRING was given, or 1 otherwise.
.. END DESCRIPTION
Examples
--------
.. BEGIN EXAMPLES
::
>_ string length 'hello, world'
12
>_ set str foo
>_ string length -q $str; echo $status
0
# Equivalent to test -n "$str"
.. END EXAMPLES