diff options
Diffstat (limited to 'dviware/dvisvgm/src/XMLString.cpp')
-rw-r--r-- | dviware/dvisvgm/src/XMLString.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/dviware/dvisvgm/src/XMLString.cpp b/dviware/dvisvgm/src/XMLString.cpp index b07e0e287b..fcafb8d1ee 100644 --- a/dviware/dvisvgm/src/XMLString.cpp +++ b/dviware/dvisvgm/src/XMLString.cpp @@ -21,6 +21,7 @@ #include <cmath> #include <cstdlib> #include "Unicode.hpp" +#include "utility.hpp" #include "XMLString.hpp" using namespace std; @@ -89,17 +90,8 @@ XMLString::XMLString (double x) { } if (std::abs(x) < 1e-6) x = 0; - assign(to_string(x)); - size_t pos = find('.'); - if (pos != string::npos) { - pos = find_last_not_of('0'); - if (pos != string::npos) { - erase(pos+1); // remove trailing zeros - if (at(length()-1) == '.') - pop_back(); // remove trailing dot - } - } - pos = find("0."); + assign(util::to_string(x)); + size_t pos = find("0."); if (pos != string::npos && (pos == 0 || at(pos-1) == '-')) erase(pos, 1); } |