Results 1 to 15 of 15
  1. #1
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default how to at strings to a string like a table

    how to add strings to a string and the string to looks like a table


    to look like this

    something 1,20 235,12
    some 25,10 89,20
    anythingSt 4,20 4556,10

    each string should be added on by one to the main string which should has the above form

    thanks for your time

  2. #2
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    not like that is now

    i added a specific number among the elements

  3. #3
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    asd 4545
    as 42
    asdsd 544

  4. #4
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    ertgdfgdfg dfgdfgdfg
    dfdfgdf gggg
    dffg fffffff

  5. #5
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    i cannot show
    make a better forum

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    What have you done so far?

  7. #7
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    ok

    i want to print some strings in a form like a table
    but i am using longString class to print

    every string is added to the string that longString takes
    and i am calculate the spaces that every string shoult has to each other such that the output will look like a table

    but as i understand the characters when are printed does not have the same size and the space among the strings is not fixed
    and the print does not looks like the output of the string on the cmd

    what is the easy way to fix this?

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Perhaps printing on the command line is not such a good idea then.
    Why not use a JTable to present the data?

  9. #9
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    i didnt explain good

    i am printing through a printer a string
    also the string is printed to the cmd to
    System.out.print(string)

    the same string has diferent form on the paper and diferent on the cmd

    i want the form on the paper to be the same as the the string output on the cmd

  10. #10
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    ok i fix it for the moment i set the font to monospaced and everything has the same size

    thank for nothing guys

    if anyone has a better solution please let me know

  11. #11
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    Ok first off, comments like
    make a better forum
    and
    thank for nothing guys
    are unlikely to get you much help.

    That aside, it sounds to me (though it is difficult for me to understand you fully) that you are trying to print tabular data to the system console. There are two problems. First off, everyone's console will be different, and may or may not use a fixed-width font. Secondly, it sounds like you're trying to make uniform spacing between values.

    This can be accomplished with a simple method that measures the length of the string before printing and then appends needed spaces, you might also be able to use methods provided in one of the String related classes to do this. Personally, I rolled my own using a simple method.

  12. #12
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by petrosgraf View Post
    ok i fix it for the moment i set the font to monospaced and everything has the same size
    thank for nothing guys
    The quality of the answers you might receive are often directly related to the quality of the questions you ask.

    And are you sure that you want to insult everyone in this forum, including those who otherwise might have helped you in the future? Is this really your goal with this comment?

    if anyone has a better solution please let me know
    I think that for this problem, given your statement above, you're on your own. Much luck.
    Last edited by Fubarable; 09-21-2009 at 03:25 AM.

  13. #13
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by petrosgraf View Post
    ok i fix it for the moment i set the font to monospaced and everything has the same size

    thank for nothing guys

    if anyone has a better solution please let me know
    ignoreList++ ;

  14. #14
    petrosgraf is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    do not cry about my comments
    i do not have something personal with anyone of you
    i wrote thanks for nothing because i didn't got any help for this problem
    and the comment for the forum you can use it to fix the bug instead of crying

    if someone wants to help and knows what to do is good to help without to wait

    THANKS and THANKS AND I LOVE YOU MEN!!!!!

    anyway thanks again and please accept my apologize for the straight way that i write

  15. #15
    Dieter's Avatar
    Dieter is offline Member
    Join Date
    Sep 2009
    Posts
    91
    Rep Power
    0

    Default

    you got problems with yourself lol.

    i would have used a Stringbuffer or Stingbuilder for doing this.

    if i understand the thing you are trying to do, wich i don't understand rly :p

    anyway good luck,

    Dieter
    Programming today is a race between software engineers striving to build bigger and better idiot proof programs,and the Universe trying to produce bigger and better idiots...

Similar Threads

  1. The java Strings
    By greenteachacha in forum Jobs Discussion
    Replies: 8
    Last Post: 04-16-2009, 05:08 AM
  2. comparing strings
    By diggitydoggz in forum New To Java
    Replies: 7
    Last Post: 12-23-2008, 04:40 AM
  3. characters + strings
    By Gilgamesh in forum New To Java
    Replies: 3
    Last Post: 03-02-2008, 09:10 PM
  4. Help with drawing strings!
    By JavaInLove in forum AWT / Swing
    Replies: 1
    Last Post: 02-05-2008, 03:39 AM
  5. Help with Vectors and Strings...
    By kaban in forum New To Java
    Replies: 2
    Last Post: 12-09-2007, 09:04 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
  •