| | |
Formatting Console output
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2008
Posts: 10
Reputation:
Solved Threads: 0
Hi all:
I'm a newbie at Java and having fun
So I'm doing a pattern program, so far so good, but I wanted to ask if there is any console specifier for spaces only and not width between integers. I'm using only integers so I thought I should use %5d inside a printf statement. But alas, it just creates big spaces between my numbers. What I need is a specifier that does not mess with the space between my numbers and makes my whole number line move to the right. Is such thing existent? Or is there a way to format everything to the right, like one would do in a word document.
I'm a newbie at Java and having fun
So I'm doing a pattern program, so far so good, but I wanted to ask if there is any console specifier for spaces only and not width between integers. I'm using only integers so I thought I should use %5d inside a printf statement. But alas, it just creates big spaces between my numbers. What I need is a specifier that does not mess with the space between my numbers and makes my whole number line move to the right. Is such thing existent? Or is there a way to format everything to the right, like one would do in a word document.
![]() |
Similar Threads
- Pascal's Triangle in C (C)
- Printing   for formatting String text (Java)
- scanf discussion (C)
- How to install slackware (Not as easy as MEPIS) (Getting Started and Choosing a Distro)
- Formatting console (C++)
Other Threads in the Java Forum
- Previous Thread: requesting permission to ask someone a question on java
- Next Thread: Jasper Report (format numeric) problem
| Thread Tools | Search this Thread |
Tag cloud for Java
affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth businessintelligence chat class classes client code component csv database desktop draw ebook eclipse equation error event exception fractal game givemetehcodez graphics gui html ide image input integer intersect iphone j2me java java.xls javaexcel javaprojects jmf jni jpanel julia linked linux list loop mac main map method methods mobile netbeans newbie number online open-source oracle parameter print problem program programming project properties recursion reference replaysolutions reporting rotatetext scanner screen scrollbar server set size sms socket sort sql string superclass swing template test threads time tree windows working xstream





