P
Pete Hodgson
I'm writing some c# code to output some data in a format that a
Fortran program can use. Yep, I said Fortran :|
What I need is to write a floating point number into a string that is
always 7 characters long, with a space prefixed before the number. For
example:
1.34567
1234.67
.234567
I figured that this would be a simple job with String.Format(), like
so:
double dNumber;
String.Format(" {0,7:g}", dNumber );
however, the output of this is something like:
91.3481478886182
141.785454332755
it seems that the alignment part of the format string is being
ignored.
Can anyone tell me what I'm missing here?
Fortran program can use. Yep, I said Fortran :|
What I need is to write a floating point number into a string that is
always 7 characters long, with a space prefixed before the number. For
example:
1.34567
1234.67
.234567
I figured that this would be a simple job with String.Format(), like
so:
double dNumber;
String.Format(" {0,7:g}", dNumber );
however, the output of this is something like:
91.3481478886182
141.785454332755
it seems that the alignment part of the format string is being
ignored.
Can anyone tell me what I'm missing here?