From 9c1cb443a22679f038451b4491c4c50ec53f77a2 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Thu, 8 Mar 2018 12:31:49 +0100 Subject: Allow multiple modifier characters in io:format control sequences This makes it possible to print unicode atoms at the same time as suppressing detection of printable lists. --- lib/stdlib/doc/src/io.xml | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml index 6a7c06188b..f1037ec76b 100644 --- a/lib/stdlib/doc/src/io.xml +++ b/lib/stdlib/doc/src/io.xml @@ -137,11 +137,11 @@ Hello world! ok

The general format of a control sequence is ~F.P.PadModC.

-

Character C determines the type of control sequence - to be used, F and P are optional numeric - arguments. If F, P, or Pad is *, - the next argument in Data is used as the numeric value - of F or P.

+

The character C determines the type of control sequence + to be used. It is the only required field. All of F, + P, Pad, and Mod are optional. For example, + to use a # for Pad but use the default values for + F and P, you can write ~..#C.

F is the field width of the printed argument. A @@ -167,13 +167,26 @@ ok The default padding character is ' ' (space).

-

Mod is the control sequence modifier. It is a - single character that changes the interpretation of - Data. This can be t, for Unicode translation, - or l, for stopping p and P from - detecting printable characters.

+

Mod is the control sequence modifier. This is + one or more characters that change the interpretation of + Data. The current modifiers are t, for Unicode + translation, and l, for stopping p and P + from detecting printable characters.

+

If F, P, or Pad is a * character, + the next argument in Data is used as the value. + For example:

+
+1> io:fwrite("~*.*.0f~n",[9, 5, 3.14159265]).
+003.14159
+ok
+

To use a literal * character as Pad, it must be + passed as an argument:

+
+2> io:fwrite("~*.*.*f~n",[9, 5, $*, 3.14159265]).
+**3.14159
+ok

Available control sequences:

~ -- cgit v1.2.3