Returns a string produced according to a formatting string.

Parameters:
NameTypeDescription
formatstring

The format to be used when creating the string. ( i.e. 'My name is %1$s %2$s' ).

argsArray

Arguments to be replaced in the format string.

Since
  • 1.0.0
Returns:

Returns the resulting string.

Type: 
string
Example
import { vsprintf } from "@gravityforms/utils";

function Example() {
   const str = vsprintf( 'My name is %1$s %2$s. I am %3$i years old.', ['Joe', 'Doe', 30] );
}

Methods

(inner) sprintf_format(parse_tree, argv)

Parameters:
NameTypeDescription
parse_tree
argv

(inner) sprintf_parse(fmt)

Parameters:
NameTypeDescription
fmt