Thread: Right Justify?

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2015
    Posts
    38
    Rep Power
    4

    Right Justify?


    Looking to know if anybody knows how to right justify when the length of the input in unknown, because it's coming from a user input.

    I could use printf and define a width of say 10, but if the user enters 11 or more characters that causes the columns output to be mis-aligned. The rows with 10 or less characters will right align with a total of 10 characters per row. However, the rows with 11 or more characters will protrude out past the column to the right

    For example I get this:


    ---------1
    --------10
    10000000000
    --------20
    -------200
    ----102030
    12002030200
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2015
    Posts
    38
    Rep Power
    4
    Just to be clear about the variable's declaration, if it'll make a difference, it is declared as a double, not an int.

IMN logo majestic logo threadwatch logo seochat tools logo