• 7916阅读
  • 0回复

[共享]Qt笔记十: 数字如何转换为字符串,且保留小数点后几位 [复制链接]

上一主题 下一主题
离线青春岁月
 

只看楼主 倒序阅读 楼主  发表于: 2011-06-30
关键词: QString
Qt笔记十: 数字如何转换为字符串,且保留小数点后几位

1.       QString stry;
double y;
y = 6.44;
stry = stry.number(y,'f',1);
2. 其中’f’表示以什么样的格式输出:
Format    Meaning
e      format as [-]9.9e[+|-]999
E     format as [-]9.9E[+|-]999
f      format as [-]9.9
g     use e or f format, whichever is the most concise
G     use E or f format, whichever is the most concise
3. 小数点后保留几位?
       1表示保留一位。
go!   go!  go!  go!
快速回复
限100 字节
 
上一个 下一个