erlang经常需要将文字打印在控制台/文件中查看。。
io:format("~-20s", [String])
这样可以保证打印出来的文字等宽便于查看
可以看到是等宽的输出
还有一种是取前x位
可以看到字符串被截取了
用法解释在io:format的文档中有The general format of a control sequence is ~F.P.PadModC.
The 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.
F is the field width of the printed argument. A