[erlang-questions] Aligned printing with io:format
Kaiduan Xie
kaiduanx@REDACTED
Sun Oct 23 16:05:07 CEST 2011
Cool, thanks a lot Anthony.
On Sun, Oct 23, 2011 at 5:19 AM, Anthony Ramine <nox@REDACTED> wrote:
>
> Le 23 oct. 2011 à 06:54, Kaiduan Xie a écrit :
>
>> 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
>
> Hi,
>
> io:format("|~4B|~4B|~4B|~4B|~n", [10, 51, 6, 321]).
>
> --
> Anthony Ramine / @nokusu
> Dev:Extend — http://dev-extend.eu/
> So as I pray, “Unlimited Erlang Works”
>
>
More information about the erlang-questions
mailing list