如果双数或浮点数全为零,如何隐藏小数部分。我正在将浮点数转换为字符串及其显示尾数部分,即使它为零。例如:
double number = 123.00;
string strNumber = number.ToString(); // it shows "123.0", what I need is only "123"
double secondNumber = 123.2234;
string strSecondNumber = secondNumber.ToString(); // it shows "123.2234" as needed.
.NET 中有没有内置的解决方案来完成它?谢谢