← Back to Overview

Padding with zeros

Pad numbers with zeros to a specific width.

{ 3 :number minimumIntegerDigits=3 }

Some applications require numbers to be padded with zeros to a specific width. This is often the case when numbers are displayed in a fixed-width font or formatted as part of a larger string.

The minimum number of integer digits can be specified using the minimumIntegerDigits option. Any missing digits are filled with zeros.

Related