diff --git a/Foundation/include/Poco/Format.h b/Foundation/include/Poco/Format.h index 2334b11a0..c8f9835fa 100644 --- a/Foundation/include/Poco/Format.h +++ b/Foundation/include/Poco/Format.h @@ -62,6 +62,8 @@ std::string Foundation_API format(const std::string& fmt, const Any& value); /// * e signed floating-point value in the form [-]d.dddde[]dd[d] /// * E signed floating-point value in the form [-]d.ddddE[]dd[d] /// * f signed floating-point value in the form [-]dddd.dddd + /// * g use the shortest representation: %e or %f + /// * G use the shortest representation: %E or %F /// * s std::string /// * v std::string_view /// * z std::size_t diff --git a/Foundation/src/Format.cpp b/Foundation/src/Format.cpp index 951f7dcb9..1b7cc2bc6 100644 --- a/Foundation/src/Format.cpp +++ b/Foundation/src/Format.cpp @@ -128,6 +128,8 @@ namespace case 'e': str << std::scientific; break; case 'E': str << std::scientific << std::uppercase; break; case 'f': str << std::fixed; break; + case 'g': str << std::defaultfloat; break; + case 'G': str << std::defaultfloat << std::uppercase; break; } } @@ -212,6 +214,8 @@ namespace case 'e': case 'E': case 'f': + case 'g': + case 'G': switch (mod) { case 'l': str << AnyCast(*itVal++); break;