File: string-repeat.rst

package info (click to toggle)
fish 4.2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,980 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (54 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
string-repeat - multiply a string
=================================

Synopsis
--------

.. BEGIN SYNOPSIS

.. synopsis::

    string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [-N | --no-newline]
                  [-q | --quiet] [STRING ...]
    string repeat [-N | --no-newline] [-q | --quiet] COUNT [STRING ...]

.. END SYNOPSIS

Description
-----------

.. BEGIN DESCRIPTION

``string repeat`` repeats the *STRING* **-n** or **--count** times. The **-m** or **--max** option will limit the number of outputted characters (excluding the newline). This option can be used by itself or in conjunction with **--count**. If both **--count** and **--max** are present, max char will be outputted unless the final repeated string size is less than max, in that case, the string will repeat until count has been reached. Both **--count** and **--max** will accept a number greater than or equal to zero, in the case of zero, nothing will be outputted. The first argument is interpreted as *COUNT* if **--count** or **--max** are not explicitly specified. If **-N** or **--no-newline** is given, the output won't contain a newline character at the end. Exit status: 0 if yielded string is not empty, 1 otherwise.

.. END DESCRIPTION

Examples
--------

.. BEGIN EXAMPLES

Repeat Examples
^^^^^^^^^^^^^^^

::

    >_ string repeat -n 2 'foo '
    foo foo

    >_ echo foo | string repeat -n 2
    foofoo

    >_ string repeat -n 2 -m 5 'foo'
    foofo

    >_ string repeat -m 5 'foo'
    foofo

    >_ string repeat 2 'foo'
    foofoo

    >_ string repeat 2 -n 3
    222

.. END EXAMPLES