Did you know ... | Search Documentation: |
Writef |
writef(Atom, []).
See writef/2
for details.Escape sequences to generate a single special character:
\n | Output a newline character (see also nl/[0,1]) |
\l | Output a line separator (same as \n ) |
\r | Output a carriage return character (ASCII 13) |
\t | Output the ASCII character TAB (9) |
\\ | The character
is output |
\% | The character
is output |
\nnn | where <nnn> is an integer (1-3 digits); the character with code <nnn> is output (NB : <nnn> is read as decimal) |
Note that \l
, \nnn
and \\
are
interpreted differently when character escapes are in effect. See
section 2.15.1.3.
Escape sequences to include arguments from Arguments. Each time a % escape sequence is found in Format the next argument from Arguments is formatted according to the specification.
%t | print/1 the next item (mnemonic: term) |
%w | write/1 the next item |
%q | writeq/1 the next item |
%d | Write the term, ignoring operators. See also write_term/2. Mnemonic: old Edinburgh display/1 |
%p | print/1
the next item (identical to %t ) |
%n | Put the next item as a character (i.e., it is a character code) |
%r | Write the next item N times where N is the second item (an integer) |
%s | Write the next item as a String (so it must be a list of characters) |
%f | Perform a ttyflush/0 (no items used) |
%Nc | Write the next item Centered in N columns |
%Nl | Write the next item Left justified in N columns |
%Nr | Write the next item Right justified in N columns. N is a decimal number with at least one digit. The item must be an atom, integer, float or string. |
?- swritef(S, '%15L%w', ['Hello', 'World']). S = "Hello World"
swritef(String, Format, []).