Beispiel #1
0
std::string formatString(const char* format, Args... args)
{
    assert(format != nullptr);

    std::stringstream ss;
    streamprintf(ss, format, args...);
    return ss.str();
}
Beispiel #2
0
void streamprintf(std::ostream& stream, const char* format, const T& value, Args... args)
{
	while (*format)
	{
		if (*format == '%' && *++format != '%')
		{
			auto flags = stream.flags();
			parseFormat(stream, format);
			stream << value;
			stream.flags(flags);
			streamprintf(stream, format, args...);
			return;
		}
		else
		{
			stream << *format++;
		}
	}
}
Beispiel #3
0
std::string formatString(const char* format, Args... args)
{
	std::stringstream ss;
	streamprintf(ss, format, args...);
	return ss.str();
}