A custom format allows the specification of how numeric values are formatted, for example:
1 2 3 4 5 6 7 | [DECIMAL=.] [THOUSANDS=,] [PRECISION=2] [PREFIX=$] [SUFFIX=] [REMOVE=.00] [STRIPTRAILINGZEROS=YES] |
Where the data contains values of a different types, each can be formatted independently. Take fields containing:
1 2 3 4 | €12 12 EUR 12 USD 10.5 KG |
Each type has an identifier used to pick the correct formatting options. This contains a regular expression. When matched to the data, the subsequent options are used. For example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <.*USD> [DECIMAL=.] [THOUSANDS=,] [PRECISION=2] [PREFIX=$] <.*EUR> [DECIMAL=,] [THOUSANDS=.] [PRECISION=2] [PREFIX=€] <€.> [DECIMAL=,] [THOUSANDS=.] [PRECISION=2] [PREFIX=€] <.*KG> [DECIMAL=,] [THOUSANDS=.] [PRECISION=1] [PREFIX=] [SUFFIX= Kilo] <> [DECIMAL=.] [THOUSANDS=,] [PRECISION=0] [PREFIX=?] |
so <.*USD> matches a field that ends in USD. <> indicates which options to use when no match is found. The formatted fields content is now shown as:
1 2 3 4 | €12,00 €12,00 $12.00 10,6 Kilo |