,
,
,##0
# means if there are numbers, it will be displayed, if there are no numbers, it will be empty; 0 means if there are digits, it will be displayed, there will be no numbers If so, it is displayed as 0.
EG:
public string GetFormateString(int Precision, double Number) { string text = "###,###,###,##0."; for (int i = 0; i < Precision; i++) { text += "0"; } return Number.ToString(text); }
## In the above example, according to the precision passed in by the function (Precision ), quantity (Number) to output the string you said needs the format. The function of the for loop is to splice the number of zeros after the decimal point and occupy the zero place.
Through breakpoint debugging, it can be seen, as shown below:
## The parameters passed in when calling are:MessageBox.Show(GetFormateString(10,2.0));
For content related to the custom number format string, you can view the MSDN website: click to open Link
,
,
,##0. For more related content, please pay attention to the PHP Chinese website (www. php.cn)!