up previous next
format

convert object to formatted string

Syntax
format(E: OBJECT, N: INT): STRING

Description
Like Sprint, this function converts the value of E into a string. If the string has fewer than N characters, then spaces are added to the front to make the length N.

Example
/**/  L := [5^n | n in 0..7];
/**/  foreach F in L do print format(F,8); endforeach;
       1       5      25     125     625    3125   15625   78125

/**/  M := format(L,20);
/**/  M;  -- "format" does not truncate
[1, 5, 25, 125, 625, 3125, 15625, 78125]
/**/  type(L);
LIST
/**/  type(M);
STRING

See Also