From 53a9725e0ce746d9808d85b5550a13433c35217c Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 9 Sep 2025 19:05:57 +0200 Subject: [PATCH] add string trimming function --- util/format.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/format.h b/util/format.h index e0e9bbf..de5ae5a 100644 --- a/util/format.h +++ b/util/format.h @@ -1,5 +1,6 @@ #pragma once #include +#include #include #include @@ -25,4 +26,11 @@ inline std::string format(const char* fmt, ...) return std::string(buf.data(), needed); } + +inline std::string to_string_trimmed(double value) +{ + std::ostringstream oss; + oss << std::defaultfloat << value; + return oss.str(); +} } // namespace trnr \ No newline at end of file