mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-03 11:51:15 -03:00
Add string sub --end (#6765)
This commit is contained in:
@@ -8,7 +8,7 @@ Synopsis
|
||||
|
||||
::
|
||||
|
||||
string sub [(-s | --start) START] [(-l | --length) LENGTH] [(-q | --quiet)] [STRING...]
|
||||
string sub [(-s | --start) START] [(-e | --end) END] [(-l | --length) LENGTH] [(-q | --quiet)] [STRING...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
@@ -17,7 +17,7 @@ Description
|
||||
|
||||
.. BEGIN DESCRIPTION
|
||||
|
||||
``string sub`` prints a substring of each string argument. The start of the substring can be specified with ``-s`` or ``--start`` followed by a 1-based index value. Positive index values are relative to the start of the string and negative index values are relative to the end of the string. The default start value is 1. The length of the substring can be specified with ``-l`` or ``--length``. If the length is not specified, the substring continues to the end of each STRING. Exit status: 0 if at least one substring operation was performed, 1 otherwise.
|
||||
``string sub`` prints a substring of each string argument. The start/end of the substring can be specified with ``-s``/``-e`` or ``--start``/``--end`` followed by a 1-based index value. Positive index values are relative to the start of the string and negative index values are relative to the end of the string. The default start value is 1. The length of the substring can be specified with ``-l`` or ``--length``. If the length or end is not specified, the substring continues to the end of each STRING. Exit status: 0 if at least one substring operation was performed, 1 otherwise. ``--length`` is mutually exclusive with ``--end``.
|
||||
|
||||
.. END DESCRIPTION
|
||||
|
||||
@@ -37,4 +37,16 @@ Examples
|
||||
>_ string sub --start=-2 abcde
|
||||
de
|
||||
|
||||
>_ string sub --end=3 abcde
|
||||
abc
|
||||
|
||||
>_ string sub -e -1 abcde
|
||||
abcd
|
||||
|
||||
>_ string sub -s 2 -e -1 abcde
|
||||
bcd
|
||||
|
||||
>_ string sub -s -3 -e -2 abcde
|
||||
c
|
||||
|
||||
.. END EXAMPLES
|
||||
|
||||
Reference in New Issue
Block a user