QRegExp rx;
rx.setPattern("(\\.){0,1}0+$");
double double01 = 15648.120000;
double double02 = 15648.000000
QString ceshi01 = QString("%1").arg(double01,,'f',-).replace(rx,"");
QString ceshi02 = QString("%1").arg(double02,,'f',-).replace(rx,"");

碰到需求了,做个笔记

04-26 22:07