Skip to main content

Number formatting

Padding​

Padding is controlled by adding a parameter that begins with either WIDTH= (to control the minimum number of digits), and/or PADDING= which changes the default padding character from zero to some other character, e.g. space. For example:

NumberParameterResult
42(none)42
42WIDTH=500042
42WIDTH=5;PADDING=␣␣␣␣42

A named format that writes numbers with its own digits, such as alpha or arabicdigits, pads with its first digit, the way the default format pads with 0 v6.1. For example, {YEAR;FORMAT=alpha;WIDTH=5} gives AACZY for 2026. Before v6.1, it padded with spaces. PADDING= still takes precedence, and formats that write names, such as shortmonth, still pad with spaces.

Number to text conversion​

The format used to convert a number to a text can be changed by adding a parameter that starts with FORMAT=. The following formats are built in, but more formats can be created by the user:

FormatDescription
alphaAlpha encoding using capital letters. Exactly the same as #ABCDEFGHIJKLMNOPQRSTUVWXYZ
arabicdigits v6.1Arabic-Indic digits, ٠١٢٣٤٥٦٧٨٩
persiandigits v6.1Persian digits, ۰۱۲۳۴۵۶۷۸۹
thaidigits v6.1Thai digits, ๐๑๒๓๔๕๖๗๘๙
shortmonthTranslates numbers 1-12 into an English three capital letter month name.
(JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC)
shortweekdayTranslates numbers 1-7 into an English three capital letter week day name.
(MON, TUE, WED, THU, FRI, SAT, SUN)

Additionally, the following special formats are available, determined by the special first character of the format:

First characterFormatDescription
{{word1,word2,...}

Use a lookup table. The words are separated by semicolon (;), plus a closing brace at the end. For example:

  • FORMAT={ONE;TWO}
    This will convert the number 1 to the text ONE, and 2 to TWO. Any other number will generate an error.

If the first word starts with #, then it changes the starting number from 1 to something else, which can be very useful when converting years to special texts, like this:

  • {YEAR;FORMAT={#2020;A;B;C;D;E}}
    If the year is 2022, C will be printed.
##numerals

Use numerals instead of standard numerals 0-9. For example:

  • #01234567890ABCDEF (Hexadecimal)
  • #ABCDEFGHIJKLMNOPQRSTUVWXYZ (Letters A-Z)
  • #ABCDEFGHJKLMNPQRSTUVWXYZ (Letters A-Z except I or O)