|  |  5.1.148 sprintf Procedure from librarystandard.lib(see  standard_lib).
 
Example:Syntax:
sprintf (string_expression[,any_expressions] )
Return:
string
Purpose:
sprintf(fmt,...);performs output formatting. The first
argument is a format control string. Additional arguments may be
required, depending on the content of the control string. A series
of output characters is generated as directed by the control string;
these characters are returned as a string.The control string
 fmtis simply text to be copied,
except that the string may contain conversion specifications.Type
 help print;for a listing of valid conversion
specifications. As an addition to the conversions ofprint,
the%nand%2conversion specification does not
consume an additional argument, but simply generates a newline
character.
Note:
If one of the additional arguments is a list, then it should be
wrapped in an additional list()command, since passing a list
as an argument flattens the list by one level.
 See also:
 fprintf;
 print;
 printf;
 string.|  |   ring r=0,(x,y,z),dp;
module m=[1,y],[0,x+z];
intmat M=betti(mres(m,0));
list l = r, m, M;
string s = sprintf("s:%s,%n l:%l", 1, 2); s;
==> s:1,
==>  l:int(2)
s = sprintf("s:%n%s", l); s;
==> s:
==> (QQ),(x,y,z),(dp(3),C)
s = sprintf("s:%2%s", list(l)); s;
==> s:
==> (QQ),(x,y,z),(dp(3),C),y*gen(2)+gen(1),x*gen(2)+z*gen(2),1,1 
s = sprintf("2l:%n%2l", list(l)); s;
==> 2l:
==> list("(QQ),(x,y,z),(dp(3),C)",
==> module(y*gen(2)+gen(1),
==> x*gen(2)+z*gen(2)),
==> intmat(intvec(1,1 ),1,2))
==> 
s = sprintf("%p", list(l)); s;
==> [1]:
==>    // coefficients: QQ considered as a field
==> // number of vars : 3
==> //        block   1 : ordering dp
==> //                  : names    x y z
==> //        block   2 : ordering C
==> [2]:
==>    _[1]=y*gen(2)+gen(1)
==>    _[2]=x*gen(2)+z*gen(2)
==> [3]:
==>    1,1 
s = sprintf("%;", list(l)); s;
==> [1]:
==>    // coefficients: QQ considered as a field
==> // number of vars : 3
==> //        block   1 : ordering dp
==> //                  : names    x y z
==> //        block   2 : ordering C
==> [2]:
==>    _[1]=y*gen(2)+gen(1)
==>    _[2]=x*gen(2)+z*gen(2)
==> [3]:
==>    1,1 
==> 
s = sprintf("%b", M); s;
==>            0     1
==> ------------------
==>     0:     1     1
==> ------------------
==> total:     1     1
==> 
 | 
 
 |