Core/String: Add Format static method
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <Nazara/Core/Endianness.hpp>
|
||||
#include <Nazara/Core/SerializationContext.hpp>
|
||||
#include <atomic>
|
||||
#include <cstdarg>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -239,6 +240,8 @@ namespace Nz
|
||||
|
||||
static String Boolean(bool boolean);
|
||||
static int Compare(const String& first, const String& second);
|
||||
static inline String Format(const char* format, ...);
|
||||
static String FormatVA(const char* format, va_list arg);
|
||||
static String Number(float number);
|
||||
static String Number(double number);
|
||||
static String Number(long double number);
|
||||
|
||||
@@ -19,6 +19,23 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Build a string using a format and returns it
|
||||
* \return Formatted string
|
||||
*
|
||||
* \param format String format
|
||||
* \param ... Format arguments
|
||||
*/
|
||||
String String::Format(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
String result = FormatVA(format, args);
|
||||
va_end(args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Releases the content to the string
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user