浮点与点后2位数字浮点、数字

2023-09-05 08:44:39 作者:热情喂冷风

我会格式化一个浮点数的机器人与点后的2位数。 我搜索的例子,但我din't找到一个。

可以有一个人帮助我。

解决方案

 浮动F = 2.3455f;
字符串测试=的String.Format(%02F,F);
 

I will Format a Floating Point Number in android with 2 Digits after the point. I search for a Example but i din´t find one.

TI 推出首款浮点数字信号控制器

Can some one help me.

解决方案

float f = 2.3455f;  
String test = String.format("%.02f", f);