How to add Decimal Zeros to a integer(whole) number(if value 123 is should be 123.00)
Below code is working these condition , that isif 1.0 is ==1.10
if .1 is ==0.10
if 111.2222 is == 111.20
MyCode:
string val = "1234.22";
if (val.Split('.')[1].Length > 2)
{
val = val.Split('.')[0] + '.' + val.Split('.')[1].Substring(0, 1);
}
decimal d = Convert.ToDecimal(val);
string result = d.ToString("0.00");
but i want to add one more condition instead in my code that is
If i give value = 123 it should be 123.00 that's all
if 123 is == 123.00
i cant able to done this. so help me to add that condition instead of my code.
thanking with
Paul.S