[erlang-questions] Aligned printing with io:format

Kaiduan Xie <>
Sun Oct 23 06:54:02 CEST 2011


How to print the integer in particular width, and right aligned? For
the width of 3, and for the following input,

io:format("|~p|~p|~p|~p", [10, 51, 6, 321]).

The following output is needed,

|  10|  51|   6| 321|

What is the format string to produce the desired output? Can't figure
out from http://www.erlang.org/doc/man/io.html#format-1 :)

Thanks,

/Kaiduan



More information about the erlang-questions mailing list