src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/eval/builtin_fn_str.d.elv (about)

     1  #doc:html-id str-lt
     2  # Outputs whether `$string`s in the given order are strictly increasing. Outputs
     3  # `$true` when given fewer than two strings.
     4  fn '<s' {|@string| }
     5  
     6  #doc:html-id str-le
     7  # Outputs whether `$string`s in the given order are strictly non-decreasing.
     8  # Outputs `$true` when given fewer than two strings.
     9  fn '<=s' {|@string| }
    10  
    11  #doc:html-id str-eq
    12  # Outputs whether `$string`s are all the same string. Outputs `$true` when given
    13  # fewer than two strings.
    14  fn '==s' {|@string| }
    15  
    16  #doc:html-id str-ne
    17  # Outputs whether `$a` and `$b` are not the same string. Equivalent to `not (==s
    18  # $a $b)`.
    19  fn '!=s' {|a b| }
    20  
    21  #doc:html-id str-gt
    22  # Outputs whether `$string`s in the given order are strictly decreasing. Outputs
    23  # `$true` when given fewer than two strings.
    24  fn '>s' {|@string| }
    25  
    26  #doc:html-id str-ge
    27  # Outputs whether `$string`s in the given order are strictly non-increasing.
    28  # Outputs `$true` when given fewer than two strings.
    29  fn '>=s' {|@string| }
    30  
    31  # Output the width of `$string` when displayed on the terminal. Examples:
    32  #
    33  # ```elvish-transcript
    34  # ~> wcswidth a
    35  # ▶ (num 1)
    36  # ~> wcswidth lorem
    37  # ▶ (num 5)
    38  # ~> wcswidth 你好,世界
    39  # ▶ (num 10)
    40  # ```
    41  fn wcswidth {|string| }
    42  
    43  # Convert arguments to string values.
    44  #
    45  # ```elvish-transcript
    46  # ~> to-string foo [a] [&k=v]
    47  # ▶ foo
    48  # ▶ '[a]'
    49  # ▶ '[&k=v]'
    50  # ```
    51  fn to-string {|@value| }
    52  
    53  # Outputs a string for each `$number` written in `$base`. The `$base` must be
    54  # between 2 and 36, inclusive. Examples:
    55  #
    56  # ```elvish-transcript
    57  # ~> base 2 1 3 4 16 255
    58  # ▶ 1
    59  # ▶ 11
    60  # ▶ 100
    61  # ▶ 10000
    62  # ▶ 11111111
    63  # ~> base 16 1 3 4 16 255
    64  # ▶ 1
    65  # ▶ 3
    66  # ▶ 4
    67  # ▶ 10
    68  # ▶ ff
    69  # ```
    70  fn base {|base @number| }
    71  
    72  # Deprecated alias for [`re:awk`](). Will be removed in 0.21.0.
    73  fn eawk {|&sep='[ \t]+' &sep-posix=$false &sep-longest=$false f inputs?| }