###,###,###,# #0
#是如果有数字的话就显示, no number is empty, 0 is displayed if there is a number, no number 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 example above, according to the function's incoming precision (Precision), quantity (number), you say that you need to format the string, where the function of the For loop is to stitch the number of zeros after the decimal point, zero placeholder.
Debugging through breakpoints, visible, such as:
The arguments passed in at the time of invocation are:
MessageBox.Show (getformatestring (10,2.0));
The output is:
For content with custom numeric format strings, you can view the MSDN Web site: Click the Open link
The above is the C # custom numeric format string ToString ###,###,###,# #0的内容, for more information please follow topic.alibabacloud.com (www.php.cn)!