Slow week, boring life...

by Codewiz51 10. October 2008 22:54

I've been working on the test program for dcdflib this week. I have six more test routines to complete, plus I need to replace some timing code for reporting the speed of the calculations. The old code depended on Windows API time code.

I've run into some semi-interesting formatting problems with Console.WriteLine. If you use a specification similar to {0,-10,#0.0######} in a format string, the decimal points won't line up because the leading # is not filled in if the number does not take up 2 digits to the left of the decimal point. I was hoping the # would be replaced by a space, but no such luck. After doing some cursory research, I think a custom formatting function is required.

I want numbers to line up like this using Console.WriteLine:

 1.0234567   1.0234567
21.0111111  21.0111111

But all I've been able to achieve is the following:

1.0234567  1.0234567
21.0111111 21.0111111

Formatting strings need some way to specify that leading and trailing # symbols should be replaced with a space when a digit is not required.

Tags:

Programming

Comments are closed

Disclaimer

This blog represents my personal hobby, observations and views. It does not represent the views of my employer, clients, especially my wife, children, in-laws, clergy, the dog, the cat or my daughter's horse. In fact, I am not even sure it represents my views when I take the time to reread postings.  So, take most of what I say with a grain of salt.

© Copyright 2008-2014