format

fnimmutable(Char)[] format(Char, Args...)(in Char[] fmt, Args args) if (isSomeChar!Char)

Converts its arguments according to a format string into a string.

The second version of format takes the format string as template argument. In this case, it is checked for consistency at compile-time and produces slightly faster code, because the length of the output buffer can be estimated in advance.

Parameters

fmta format string
argsa variadic list of arguments to be formatted
Charcharacter type of fmt
Argsa variadic list of types of the arguments

Returns

The formatted string.

Throws

A FormatException if formatting did not succeed.

See Also

sformat for a variant, that tries to avoid garbage collection.
fntypeof(fmt) format(alias fmt, Args...)(Args args) if (isSomeString!(typeof(fmt)))

ditto