c# - Format the output of a string -


string strScore = "2" here; Or string strScore = "2.45656" Now here I am checking the status if it is

  double value = double.Parse (strscore); StrScore = value.ToString ("####");  

2.45656 This way I am showing the output as 2.45

is the input string = string = "2"; The output is shown as "2"

But now I need to show the output 2.00

/ Div>

Try it instead:

  strScore = value.ToString ("0.00");  

This means that the number is optional and the leading / indexed zeros will not be displayed. If you type 0 , the number is not optional: leading and indexed zeros will be displayed.


Comments