summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/string_util.cc6
-rw-r--r--base/string_util.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/base/string_util.cc b/base/string_util.cc
index 9db0f03..b38e182 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -1245,6 +1245,12 @@ std::wstring StringPrintf(const wchar_t* format, ...) {
return result;
}
+std::string StringPrintV(const char* format, va_list ap) {
+ std::string result;
+ StringAppendV(&result, format, ap);
+ return result;
+}
+
const std::string& SStringPrintf(std::string* dst, const char* format, ...) {
va_list ap;
va_start(ap, format);
diff --git a/base/string_util.h b/base/string_util.h
index 66518e9..723242e 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -453,6 +453,9 @@ double StringToDouble(const string16& value);
std::string StringPrintf(const char* format, ...) PRINTF_FORMAT(1, 2);
std::wstring StringPrintf(const wchar_t* format, ...) WPRINTF_FORMAT(1, 2);
+// Return a C++ string given vprintf-like input.
+std::string StringPrintV(const char* format, va_list ap) PRINTF_FORMAT(1, 0);
+
// Store result into a supplied string and return it
const std::string& SStringPrintf(std::string* dst, const char* format, ...)
PRINTF_FORMAT(2, 3);