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 | Array | Arguments to be replaced in the format string. |
- Since
- 1.0.0
- Source
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:
Name | Type | Description |
---|---|---|
parse_tree | ||
argv |
- Source
(inner) sprintf_parse(fmt)
Parameters:
Name | Type | Description |
---|---|---|
fmt |
- Source