Topic: [求助]怎么控制输出格式? |
Print this page |
1.[求助]怎么控制输出格式? | Copy to clipboard |
Posted by: mitnickcbc Posted on: 2002-12-12 12:58 要输出 1 5 8 100 23 54 24 46 2 如何控制输出内容的宽度? |
2.please elaborate your question [Re: mitnickcbc] | Copy to clipboard |
Posted by: snowbug Posted on: 2002-12-12 13:17 Please specify what exactly you want with the width of the output. You can also check out the java.text package, it contains NumberFormat class to help you do the format. |
3.Re:please elaborate your question [Re: snowbug] | Copy to clipboard |
Posted by: mitnickcbc Posted on: 2002-12-12 13:47 snowbug wrote: How? 请举个例子,输出宽度为10的“abc"。 |
4.Re:[求助]怎么控制输出格式? [Re: mitnickcbc] | Copy to clipboard |
Posted by: lucky_sesame Posted on: 2002-12-12 19:17 据我所知在JDK 1.3 中控制输出宽度能力很弱 试试这个 <a href="http://sharkysoft.com/software/java/printf/">http://sharkysoft.com/software/java/printf/</a> 我刚来,还没有积分,这么多好书都下载不了,我哭....呜... 呜...呜 |
5.Re:[求助]怎么控制输出格式? [Re: mitnickcbc] | Copy to clipboard |
Posted by: mitnickcbc Posted on: 2002-12-12 19:28 谢谢! 唉,没想到java这方面这么弱。 |
6.Re:[求助]怎么控制输出格式? [Re: lucky_sesame] | Copy to clipboard |
Posted by: Biubiu Posted on: 2002-12-12 21:20 lucky_sesame wrote: Oh, that doesn't help, guy. Take care of yourself. |
7.It's OK for formatting numbers [Re: mitnickcbc] | Copy to clipboard |
Posted by: snowbug Posted on: 2002-12-12 22:51 I think it is relatively easy and powerful to format numbers, although the format of string literals is a little weak (but I don't think it is used a lot in formatting strings). Here is a code sniplet that formats a double number:
Please refer to the DecimalFormat API for details on the usage of patterns |
8.Re:[求助]怎么控制输出格式? [Re: mitnickcbc] | Copy to clipboard |
Posted by: mitnickcbc Posted on: 2002-12-13 01:06 谢谢! 看来凭我现在的知识是搞不明白怎么回事了。 又是package,又是API, 只能过几天再研究这个问题了。 |
9.Re:[求助]怎么控制输出格式? [Re: mitnickcbc] | Copy to clipboard |
Posted by: floater Posted on: 2002-12-13 01:51 mitnickcbc wrote: Actually, it's quite powerful now, . |
10.Re:[求助]怎么控制输出格式? [Re: floater] | Copy to clipboard |
Posted by: floater Posted on: 2002-12-14 00:35 floater wrote: Here are some examples:
|
11.Re:[求助]怎么控制输出格式? [Re: mitnickcbc] | Copy to clipboard |
Posted by: mitnickcbc Posted on: 2002-12-14 01:31 太感谢了! |
12.Re:[求助]怎么控制输出格式? [Re: mitnickcbc] | Copy to clipboard |
Posted by: floater Posted on: 2002-12-15 01:17 Thanks, rainman, for editing the code back to the original. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |