473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

string formatting question

I am sorry to bother you with such a simple question. I need to print 4
columns containing integers, 8 char column width. I cannot find how to
format an integer for 8 characters. Statements like i.ToString("G8") or
i.ToString("D8") do not work (first doesn't create empty spaces, second
fills extra spaces with zeros).
Gregory
Nov 17 '05 #1
3 1270
String.Format("{0:8}", i) ? or something like this. {0: 8} {0: -8} {0, 8}
{0, -8}
Nov 17 '05 #2
Thank you. I tried them all. The one that works is:
String.Format("{0,8}{1,8}",i, j);

I wouldn't say it's entirely obvious :)
Gregory

"The Crow" <q> wrote in message
news:OV**************@TK2MSFTNGP10.phx.gbl...
String.Format("{0:8}", i) ? or something like this. {0: 8} {0: -8} {0, 8}
{0, -8}

Nov 17 '05 #3
Strangely, I was hunting for this just today. Talk about a maze of twisty
passages all the same, none going where you need to go.

Andrew
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Oliver S. | last post by:
I've developed a string-class that holds the string in an array which is a member-variable of the class and that has maximum-size which is con- figurable through a template-parameter. If any...
7
by: Roger Helliwell | last post by:
Hello Everyone, Has anyone found a quick reference for the many string formatting options for string.Format() ? I'm spending a ridiculous amount of time trying to write one line of code that...
2
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have a string, it could look like this 455 56 Gothenburg or 45556 Gothenburg What i want to do is to separate the numbers from the text into two different strings and the numbers i...
5
by: Burak | last post by:
Hello, I would like to format the string "11304200" into "11-3042.00". Can I do this with String.Format method? I have not come across any good documentation. Thank you,
17
by: Modica82 | last post by:
Hi All, I am very new to web services, so am struggling to understand exactly what I am doing with regards to its returns etc. I have been given the task of designing and developing a web...
7
by: Steven D'Aprano | last post by:
I have a sinking feeling I'm missing something really, really simple. I'm looking for a format string similar to '%.3f' except that trailing zeroes are not included. To give some examples: ...
7
by: L. Scott M. | last post by:
Have a quick simple question: dim x as string x = "1234567890" ------------------------------------------------------- VB 6 dim y as string
11
by: Dustan | last post by:
Is there any builtin function or module with a function similar to my made-up, not-written deformat function as follows? I can't imagine it would be too easy to write, but possible... 'I am...
14
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my...
1
by: Rob | last post by:
Hey folks, I should be ashamed for not knowing the answer to this question - but I don't get the opportunity to program all that much anymore... I have a data tracking program used by over 150...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.