C# Padding ,with negative sign infront of padding if number is less than 0
Posted on 2015-01-22
I would like assistance on how I can write below like on step a. the code provided below is writting like on step b. I would like to put the nagtive infront of padding instead of it padding first with 0 and then put negative sign with the amount.
-157.07 as Amount -- My data coming from the reader looks like this .
b . 000000-157.07
double amount = 0;
amount = amount + Double.Parse(reader["Amount"].ToString());
string stramount = amount.ToString("F", CultureInfo.InvariantCulture);
writeline( stramount.PadLeft(13, '0'))
Please help. data is coming from sql server