Fixed template typo

This commit is contained in:
Rene Zeldenthuis
2022-09-10 01:29:42 +02:00
parent dceee2b179
commit cbf0dbffbc
2 changed files with 10 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#include <Wstring.h>
#include <Arduino.h>
typedef struct
{
@@ -8,12 +8,12 @@ typedef struct
const String value;
} template_substitution_t;
template<typename T, size_t n>
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);
for (size_t i = 0; i < n; i++)
s.replace("{{" + String(values[i].key) + "}}", values[i].value);
return s;
}