Browse Source

Added a version of ToString that takes a va_list so it can be called from variadic functions.

Matt Benic 10 years ago
parent
commit
67e773b3ec
2 changed files with 9 additions and 0 deletions
  1. 7 0
      Source/Atomic/Core/StringUtils.cpp
  2. 2 0
      Source/Atomic/Core/StringUtils.h

+ 7 - 0
Source/Atomic/Core/StringUtils.cpp

@@ -647,6 +647,13 @@ String ToString(const char* formatString, ...)
     return ret;
 }
 
+String ToString(const char* formatString, va_list args)
+{
+    String ret;
+    ret.AppendWithFormatArgs(formatString, args);
+    return ret;
+}
+
 bool IsAlpha(unsigned ch)
 {
     return ch < 256 ? isalpha(ch) != 0 : false;

+ 2 - 0
Source/Atomic/Core/StringUtils.h

@@ -113,6 +113,8 @@ ATOMIC_API unsigned GetStringListIndex(const char* value, const String* strings,
 ATOMIC_API unsigned GetStringListIndex(const char* value, const char** strings, unsigned defaultIndex, bool caseSensitive = false);
 /// Return a formatted string.
 ATOMIC_API String ToString(const char* formatString, ...);
+/// Return a formatted string.
+ATOMIC_API String ToString(const char* formatString, va_list args);
 /// Return whether a char is an alphabet letter.
 ATOMIC_API bool IsAlpha(unsigned ch);
 /// Return whether a char is a digit.