diff options
Diffstat (limited to 'FoundationEx/Text.cpp')
-rw-r--r-- | FoundationEx/Text.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/FoundationEx/Text.cpp b/FoundationEx/Text.cpp index df828f7..ac86d5e 100644 --- a/FoundationEx/Text.cpp +++ b/FoundationEx/Text.cpp @@ -14,6 +14,7 @@ #include "Text.h" #include <cctype> +#include <cstdarg> #include <cstring> // +-------------------------------------------------------------------+ @@ -655,3 +656,15 @@ Text::replace(const char* pattern, const char* substitution) return result; } + +Text +Text::format(const char* fmt, ...) +{ + char buf[2048]; + std::va_list args; + va_start(args, fmt); + int len = std::vsnprintf(buf, 2048, fmt, args); + Text result(buf, len); + va_end(args); + return result; +} |