format the ouput of a string
Posted
by prince23
on Stack Overflow
See other posts from Stack Overflow
or by prince23
Published on 2010-05-18T08:09:07Z
Indexed on
2010/05/18
8:10 UTC
Read the original article
Hit count: 346
c#
hi
here string strTrendScore="2"; or string strTrendScore="2.45656" now here i am checking the condition if it is
double value = double.Parse(strTrendScore);
strTrendScore = value.ToString("##.##");
2.45656 like this then i am showing the output as 2.45
if the input is string strTrendScore="2"; then the ouput is shown as "2"
but now i need to show the output has 2.00 how can i format the code like this based on the condition
© Stack Overflow or respective owner