Monday, March 26, 2012

text file format

I need to create a text file which I can get working but i need it to be in
this format which I'm close but not exactly there yet.

format I need:
1234569 BMW
1253252Mercedes
9876522 Lexus
9858252 Jaguar

I'm getting this format:
1234569 BMW
1253252 Mercedes
9876522 Lexus
9858252 Jaguar

here is my code I'm using to write the lines in the text file
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
file.WriteFile(CarSales);

am I missing something?I got it working I removed the (-) sign.

instead of this:
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
i did this:
string CarSales = string.Format("{0,9}{1,8}", VINNumber, CarMake);
and now the file lines up correctly

"igotyourdotnet" wrote:

Quote:

Originally Posted by

I need to create a text file which I can get working but i need it to be in
this format which I'm close but not exactly there yet.
>
format I need:
1234569 BMW
1253252Mercedes
9876522 Lexus
9858252 Jaguar
>
I'm getting this format:
1234569 BMW
1253252 Mercedes
9876522 Lexus
9858252 Jaguar
>
here is my code I'm using to write the lines in the text file
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
file.WriteFile(CarSales);
>
am I missing something?
>
>
>
>

0 comments:

Post a Comment