Base Framework
|
#include <base/string/Format.h>
Classes | |
class | Subst |
Static Public Member Functions | |
static String | substImpl (const UTF8Stringify &text, const UTF8Stringify *args, MemorySize numberOfArgs) |
static void | printImpl (const UTF8Stringify &text, const UTF8Stringify *args, MemorySize numberOfArgs) |
template<typename... ARGS> | |
static String | subst (const UTF8Stringify &text, ARGS &&... args) |
String formatting support.
String result = Format::subst(MESSAGE("My name is %1 %2."), "John", "Doe");
You can do inline value formatting like this (hint format() is a StringOutputStream):
String result = Format::subst( MESSAGE("My value is %1."), format() << HEX << myValue, format() << ZEROPAD << setWidth(8) << 5432 );
You can also reuse to format object as a shorthand because each argument triggers automatic restart of the stream. format f; String result = Format::subst( MESSAGE("My value is %1 and %2."), f << HEX << myValue, f << ZEROPAD << setWidth(8) << 5432 );
|
static |
Print string substitution.
|
inlinestatic |
Simple string substitution.
String text = Format::subst(MESSAGE("My name is %1 and my last name is %2."), "John", "Doe");
|
static |
Simple string substitution.