format specifiers

This is a discussion on format specifiers within the C# Programming forums, part of the General Programming Boards category; when printing out on console display for example like, is there a way to set a tab length for an ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    4

    format specifiers

    when printing out on console display
    for example like, is there a way to set a tab length for an item.

    -------------------------
    |Guide to | |
    |Shanghai | |

    are there specifiers to print text to a certain lenght on one line i can do this in C but havent found anything much on specifiers on C#

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Yup.
    Code:
    Console.WriteLine("|{0,10}|", "Test");
    Console.WriteLine("|{0,-10}|", "Test");
    Output:
    Code:
    |      Test|
    |Test      |
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 11:52 PM
  2. wsprintf and format specifiers
    By incognito in forum Windows Programming
    Replies: 2
    Last Post: 01-03-2004, 10:00 PM
  3. header file bringing errors?
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2003, 01:51 PM
  4. format specifiers quick question
    By meltingdude in forum C Programming
    Replies: 2
    Last Post: 06-21-2003, 09:19 AM
  5. gcc/borland and sscanf format specifiers
    By Sargnagel in forum C Programming
    Replies: 2
    Last Post: 01-24-2003, 06:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21