Availability:built-in
format(+Output, 
+Format, :Arguments)As format/2, 
but write the output on the given Output. The de-facto 
standard only allows Output to be a stream. The SWI-Prolog 
implementation allows all valid arguments for
with_output_to/2.148Earlier 
versions defined sformat/3 . These predicates have been moved to the 
library library(backcomp). For example:
?- format(atom(A), '~D', [1000000]).
A = '1,000,000'