Options
All
  • Public
  • Public/Protected
  • All
Menu

Module string/format

Index

Functions

Functions

  • format(value: string, ...args: any[]): string
  • Helper to produce a string with a variable number of arguments. Insert variable segments into the string using the {n} notation where N is the index of the argument following the string.

    example
     format('Foo {0} Bar {1}{2}', 'yes');             //=> 'Foo yes Bar {1}{2}'
    format('Foo {0} Bar {1}{2}', 'yes', undefined); //=> 'Foo yes Bar undefined{2}'
    format('Foo {0} Bar {1}{2}', 'yes', 5, false); //=> 'Foo yes Bar 5false'

    Parameters

    • value: string

      string to which formatting is applied

    • Rest ...args: any[]

      replacements for {n}-entries

    Returns string

Generated using TypeDoc