Returns a string produced according to a formatting string.
Parameters:
Name | Type | Description |
---|---|---|
format | string | The format to be used when creating the string. ( i.e. 'My name is %1$s %2$s' ). |
args | string | Any number of parameters to be replaced in the format string. |
- Since
- 1.0.0
- Source
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);
}