format()

The function that builds a string from a template with placeholders such as %s for text and %02d for a zero-padded number.

In more detail

It is the tidy way to produce stable, predictable names from a prefix and a counter. The template decides the layout, so every name comes out the same shape.

Example

format("%s-%02d", "orders", 1)   # "orders-01"

Related terms

Taught in

References