It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings - char arrays terminated with '\0' (NULL).
mmmm I have heard this many times, and for this i always stayed away from them, but right now i am using a few of them in a project, mainly based on esp32 and 8266 and (since they have more memory) I didn't faced any error, yet. I tought about the possibility to use only cstring but String are not that bad for me now