Leading symbols

You can use the format function to insert a sign (+ or -) or currency symbol ($ or U) directly in front of the first digit or decimal point in the result.

To specify a leading symbol, the mask must start with at least two instances of the symbol. The symbol is inserted directly in front of the first digit or the decimal point and unused positions are padded with spaces. If there is insufficient space in the mask to place the expansion of the U symbol, the returned string is extended to fit the expansion.

If input is 0 and the mask contains the same symbol in all numerical positions, the result is a series of spaces with the length of the mask.

Examples

format (0.123; "$$$$.99") results in "øøø£.12"

format (0.12; "$$$9.99") results in "øø£0.12"

format (-1234.56; "$,$$$,999.99") results in "øøø£1,234.56"

format (-1234.56; "U,UUU,UU9.99-") results in "øGBP1,234.56-"

format (1234.56; "U,UUU,UU9.99") results in "øGBP1,234.56"

format (-123456.78; "+,+++,999.99") results in "ø-123,456.78"

format (-1234567; "$$,$$$,$$$.99CR") results in "£1,234,567.00CR"

format (20150302; "9999//99//99") results in "2015/03/02"

format (0; "++,+++,+++.++") results in "øøøøøøøøøøøøø"