sprintf method

String sprintf(
  1. String format, [
  2. List args = const []
])

Formats arguments into a String according to format.

Supports the full C99 format specifier syntax — see printf for details.

Example:

stdc.sprintf("%05d", [42]);           // "00042"
stdc.sprintf("%.3e", [12345.6789]);   // "1.235e+04"
stdc.sprintf("%-10s|", ["hello"]);    // "hello     |"

Implementation

String sprintf(String format, [List<dynamic> args = const []]) {
  final ap = va_start(args);
  final result = vsprintf(format, ap);
  va_end(ap);
  return result;
}