开发者

double alignment using string.format

I was trying to align doubles using string.format and display them on a tooltip.

I used: string.Format("{0,15:N2}", number);

but the results come out as:

   1234.56
    00.00

It seems some of the numbers are narrower t开发者_如何学Gohan the space. Does anyone know how to solve this problem?

Thanks!


Use a fixed-width font such as Courier New or Consolas if you want all the individual digits to line up.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜