From 9f4b6ffc6c6095aceb0e5fccd4d73d45adbf1ca8 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 15 Nov 2012 10:58:46 +0000 Subject: Added a Printf() function that returns a new AString by value. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1041 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/StringUtils.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source/StringUtils.cpp') diff --git a/source/StringUtils.cpp b/source/StringUtils.cpp index b651cc6b9..161a8a168 100644 --- a/source/StringUtils.cpp +++ b/source/StringUtils.cpp @@ -57,7 +57,7 @@ AString & AppendVPrintf(AString & str, const char *format, va_list args) -AString & Printf(AString & str, const char *format, ...) +AString & Printf(AString & str, const char * format, ...) { str.clear(); va_list args; @@ -71,6 +71,20 @@ AString & Printf(AString & str, const char *format, ...) +AString Printf(const char * format, ...) +{ + AString res; + va_list args; + va_start(args, format); + AppendVPrintf(res, format, args); + va_end(args); + return res; +} + + + + + AString & AppendPrintf(AString &str, const char *format, ...) { va_list args; -- cgit v1.2.3