Work in progress

This commit is contained in:
Rene Zeldenthuis
2022-09-10 00:59:48 +02:00
parent 3314fe7e3b
commit dceee2b179
5 changed files with 113 additions and 43 deletions

View File

@@ -0,0 +1,19 @@
#pragma once
#include <Wstring.h>
typedef struct
{
const char *key;
const String value;
} template_substitution_t;
template<typename T, size_t n>
inline String template_render(const char *format, T (&values)[n])
{
auto s = String(format);
for (size_t i=0; i<n; i++)
s.replace("{{" + String(values[n].key) + "}}", values[n].value);
return s;
}