Fix the smart truncate display in DbU::getValueString().
This commit is contained in:
parent
3b5a0f5bd2
commit
250ef29674
|
@ -341,9 +341,15 @@ namespace Hurricane {
|
||||||
} else if (mode & SmartTruncate) {
|
} else if (mode & SmartTruncate) {
|
||||||
size_t dot = s.rfind( '.' );
|
size_t dot = s.rfind( '.' );
|
||||||
if (dot != string::npos) {
|
if (dot != string::npos) {
|
||||||
size_t end = dot+1;
|
size_t end = dot;
|
||||||
for ( ; end < s.size() ; ++end ) if (s[end] != '0') break;
|
size_t nonzero = end;
|
||||||
if (end == s.size()) s.erase( dot );
|
for ( ; end < s.size() ; ++end ) {
|
||||||
|
if (s[end] != '0') nonzero = end;
|
||||||
|
}
|
||||||
|
if (nonzero == dot) s.erase( dot );
|
||||||
|
else {
|
||||||
|
if (nonzero < s.size()) s.erase( nonzero+1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unitPower != ' ') s += unitPower;
|
if (unitPower != ' ') s += unitPower;
|
||||||
|
|
Loading…
Reference in New Issue