Module API - end-user/sprintf

sprintf is minimalist string formatter utility. Supports only %[flag][width]specifier[^round-func].

Where 'flag' is:

  • 0 - to left pad with zeros.

Where 'width' is the total number of characters.

Where 'specifier' is:

  • d - decimal integer value. (use a round-func to remove the floating part.)
  • f - represents the number as a floating point number.
  • x - converts to hexadecimal number.
  • s - String of characters.

Where 'round-func' is:

  • r - rounds to the nearest decimal value.
  • d - rounds to the nearest decimal value but for 0.5 is always rounded down.
  • f - rounds to the lowermost decimal value.
  • c - rounds to the uppermost decimal value.

Index

Functions