• Returns the formatted string. It will replace parameters of the format {x}, where x is a number and will be used as the index to find the value in the array of params

    Parameters

    • stringToFormat: string

      The string to format

    • Optionalparams: string[]

      The params to replace

    Returns string

    String with the params replaced. Will throw if the number of replacement parameters do not mat

    const formattedString = formatString('Do you like {0} and {1}? I like {0}', ['apples', 'bananas'])
    // formattedString = 'Do you like apples and bananas? I like apples'