mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +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 <locale>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
|
@ -162,3 +163,9 @@ void util::trim(std::string &s) {
|
|||
rtrim(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 rtrim(std::string &s);
|
||||
extern void trim(std::string &s);
|
||||
|
||||
extern std::wstring to_wstring(double x, int precision);
|
||||
}
|
||||
|
||||
#endif // UTIL_STRINGUTIL_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue