mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
added stringutil::to_string
This commit is contained in:
parent
290fec379e
commit
213eba6072
2 changed files with 9 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue