• 4675阅读
  • 3回复

如何实现有前导零的qstring转换 [复制链接]

上一主题 下一主题
离线newdc
 

只看楼主 倒序阅读 楼主  发表于: 2009-08-28
如何实现有前导零的qstring转换?
int i=12;转换成“0012”
离线dbzhang800

只看该作者 1楼 发表于: 2009-08-28
手册中有现成的东西,不去看真的不太应该

QString QString::arg ( int a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const

This function overloads arg().

The a argument is expressed in base base, which is 10 by default and must be between 2 and 36. For bases other than 10, a is treated as an unsigned integer.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.
离线newdc

只看该作者 2楼 发表于: 2009-08-28
哈哈,谢谢了。
离线sdh-bing
只看该作者 3楼 发表于: 2009-08-28
记录了
快速回复
限100 字节
 
上一个 下一个