开发者

perl printf: float +1.2 should print as +001.200000

I have tried this:

printf("%+03.6f",+1.2开发者_运维技巧);

but it gives me

+1.200000

what I need is

+001.200000

Any ideas?


The first number is the total number of characters, so you're asking it to provide minimum 6 digits of precision in a field of size 3 and it expands the width as needed to fit. Try 11 instead (width of your example output).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜