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' ).

argsstring

Any number of parameters to be replaced in the format string.

Since
  • 1.0.0
Returns:

Returns the resulting string.

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

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