Files
esp32cam-rtsp/lib/template_render/template_render.h
Rene Zeldenthuis dceee2b179 Work in progress
2022-09-10 00:59:48 +02:00

19 lines
375 B
C++

#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;
}