Results 1 to 2 of 2
  1. #1
    computerbum is offline Member
    Join Date
    Feb 2010
    Posts
    26
    Rep Power
    0

    Default String and number formatting

    Can someone tell me how I can format this any better?

    I have tried /t but that only helps a little. How in the world do I format the
    data to right align and left align?
    I want to separate the data evenly spaced.


    Java Code:
                    System.out.format(
                            "|  " + orderID   + "   " +
                            "|  " + cOrderDate+ "   " +
                            " \t" + clientID  + " |\n");

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    12,998
    Blog Entries
    7
    Rep Power
    19

    Default

    The format( ... ) method uses a "format String" that specifies how the output should look. Read the API documentation for details.

    kind regards,

    Jos

Similar Threads

  1. Number formatting
    By gandalf5166 in forum New To Java
    Replies: 7
    Last Post: 03-26-2010, 02:54 AM
  2. Formatting String
    By ersachinjain in forum Advanced Java
    Replies: 13
    Last Post: 10-21-2009, 09:26 PM
  3. Formatting isbn number with Math.random()
    By dns77x7 in forum New To Java
    Replies: 11
    Last Post: 09-21-2008, 06:02 PM
  4. Formatting a number to currency
    By Java Tip in forum java.text
    Replies: 0
    Last Post: 04-16-2008, 10:59 PM
  5. Correct Number formatting
    By paul in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 04:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •