This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java equivalent of setw Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java equivalent of setw" Watch "Java equivalent of setw" New topic
Author

Java equivalent of setw

Stephen Ma
Greenhorn

Joined: Sep 21, 2003
Posts: 7
I'm trying to find the Java equivalent of setw in C++. Any tips on formatting will be greatly appreciated. I tried searching for this in earlier posts but I can't find it. Thanks!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24193
    
  34

Hi Stephen,
Welcome to JavaRanch!
Use the java.util.DecimalFormat class. No, it's not as convenient as setw.


[Jess in Action][AskingGoodQuestions]
Stephen Ma
Greenhorn

Joined: Sep 21, 2003
Posts: 7
Thanks a bunch, I'll give it a shot! This place is great!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java equivalent of setw
 
It's not a secret anymore!