Results 1 to 2 of 2
  1. #1
    Joris is offline Member
    Join Date
    Apr 2010
    Posts
    1
    Rep Power
    0

    Default Formatting numbers or decimals (around comma)

    Hi,

    I need to print some numbers, but I need to align them in this way (comma always on same position):


    XML Code:
     123
       4,5
      26,65
    9999,53


    So no zero padding, or just replacing by spaces (because in some fonts not all characters have the same size). How do I do this? Is there a library available?

    Thanks!
    Last edited by Joris; 04-22-2010 at 05:33 PM.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Keep a fix width to the comma, then arrange the leading spaces accordingly. You've to use a fix width, otherwise there is no way to track it.

    I'm wonder what's the requirement to align numbers like this.

Similar Threads

  1. Decimals in java help!!
    By Gold in forum New To Java
    Replies: 3
    Last Post: 12-10-2009, 12:25 AM
  2. Delimite the file using comma
    By gokulcool in forum New To Java
    Replies: 3
    Last Post: 12-30-2008, 06:40 PM
  3. number to word with decimals
    By fertas in forum New To Java
    Replies: 3
    Last Post: 08-30-2008, 04:12 AM
  4. Replies: 1
    Last Post: 07-02-2008, 02:58 PM
  5. get more decimals?!?! please help!
    By michcio in forum New To Java
    Replies: 7
    Last Post: 05-22-2008, 11:26 PM

Tags for this Thread

Posting Permissions

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