String Format List
The string::formatlist
function formats a list of strings by replacing placeholders in each string with corresponding values. It is similar to the printf
function in C
and other similar functions in other programming languages.
Syntax
string::formatlist(<template>, <value1>, <value2>, ...)
Parameters
template
: The template string containing format verbs, ie.%s
and%d
.value1, value2, ...
: The values to insert into the placeholders in each template, each of which can be a singular value or a list of permutations.
Returns
- List: A list of formatted strings.
Example
string::formatlist("%s, %s!", "Howdy", ["world", "foo", "bar"])
This function is useful for formatting multiple strings in a single operation.