Hide Comments

@FORMAT[format,string] : Reformats string, truncating it or padding it with spaces or zeros as necessary. format is of the format [-]i.a. If the optional minus sign is present, the result is left justified; otherwise it is right justified. If i is specified, and its first digit is 0, the padding character will will be 0, otherwise it will be a space. i is the minimum number of characters in the result, a is the maximum number of characters. If a is less than i, it will be ignored.

 

If string doesn't exist, @FORMAT treats it as an empty string and pads the output accordingly.

 

Examples

 

function

value

"%@format[7,Hello]"

"  Hello"

"%@format[.3,Hello]"

"Hel"

"%@format[4,5]"

"   5"

"%@format[04,5]"

"0005"

"%@format[-04,5]"

"5000"

 

See also: @COMMA, @CONVERT, @FORMATN.