CoCoA:Format

From ApCoCoAWiki

Format

convert object to formatted 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 := [1,2,3];
  M := Format(L,20);
  M;
           [1, 2, 3]
-------------------------------
  Type(L);
LIST
-------------------------------
  Type(M);
STRING
-------------------------------
  Format(L,2);  -- <quotes>Format</quotes> does not truncate
[1, 2, 3]
-------------------------------

Syntax

Format(E:OBJECT,N:INT):STRING

IO.SprintTrunc

Latex

Sprint

   <type>io</type>
   <type>printing</type>
   <type>string</type>