• Returns the replaced string of the source string ("%" placeholder) with the given parameters

    Parameters

    • Optionaltext: null | string

      the source string to inspect

    • Rest...params: any[]

      the parameters to replaced with

    Returns string | undefined | null

    the replaced string of the source string

    formatPercent("foo%s", "bar");    // "foobar"
    formatPercent("foobar %d", 2023); // "foobar 2023"
    formatPercent("hello %s, foo%s", "world", "bar"); // "hello world, foobar"