Formatter f = new Formatter(new StringBuffer());
f.format("%06d",11434235);
System.out.println(f);
版畫的價值11434235
如何限制擴大
有沒有辦法從擴大輸出限制Formatter
的格式化?
也就是說,輸出應該是114342
而不是11434235
當格式字符串是"%06d"
Formatter f = new Formatter(new StringBuffer());
f.format("%06d",11434235);
System.out.println(f);
版畫的價值11434235
如何限制擴大
有沒有辦法從擴大輸出限制Formatter
的格式化?
也就是說,輸出應該是114342
而不是11434235
當格式字符串是"%06d"
你可以簡單地格式化此爲String
,所以我想用format()
最好的解決辦法將是
Formatter f = new Formatter(new StringBuffer());
f.format("%.6s",11434235);
你的同學? http://stackoverflow.com/questions/19110103/string-format-get-maximum-value/19110210#19110210 –
@ user2310289:我不是學生隊友.. :)我發佈了它的好奇心... –
哦,我看,使用相同的值'11434235'困惑我。 –