我想以执行截断而不是舍入的方式应用 string.Format()
。例如
string.Format("##", 46.5); // output is 47, but I want 46
string.Format("##.#", 46.55); // output is 46.6, but I want 46.5
最佳答案
使用 Math.Truncate
在格式化输出之前截断
关于c# - 如何使用 string.Format() 截断而不是舍入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15706282/