added stringutil::to_string
This commit is contained in:
parent
290fec379e
commit
213eba6072
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -162,3 +163,9 @@ void util::trim(std::string &s) {
|
|||||||
rtrim(s);
|
rtrim(s);
|
||||||
ltrim(s);
|
ltrim(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::wstring util::to_wstring(double x, int precision) {
|
||||||
|
std::wstringstream ss;
|
||||||
|
ss << std::fixed << std::setprecision(precision) << x;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|||||||
@ -19,6 +19,8 @@ namespace util {
|
|||||||
extern void ltrim(std::string &s);
|
extern void ltrim(std::string &s);
|
||||||
extern void rtrim(std::string &s);
|
extern void rtrim(std::string &s);
|
||||||
extern void trim(std::string &s);
|
extern void trim(std::string &s);
|
||||||
|
|
||||||
|
extern std::wstring to_wstring(double x, int precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // UTIL_STRINGUTIL_H_
|
#endif // UTIL_STRINGUTIL_H_
|
||||||
Loading…
x
Reference in New Issue
Block a user