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

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
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-12 into an English three capital letter week day name.
(MON, TUE, WED, THU, FRI, SAT, SUN)

y 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)