'String Array on ESP32
I need to implement a string array, like:
String[] txt = {"some text1", "some text2", "some text3", "some text4"};
The standard char[]
doesn't suit me. How can I use string Array or List in Arduino IDE for ESP32?
Solution 1:[1]
You're free to use all STL facilities, including an array of strings. Standard caveats apply (dynamic RAM allocation from heap, STL uses lots of Flash for code, etc)
#include <string>
#include <array>
std::array<std::string> my_array = {"text1", "text2"};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tarmo |