How to make a string dynamic with firebase

Hello everyone I would like to have a dynamic string however I have the following error I would like to know someone who has already had this type of error

here is the code below

String numberRandom = String(random(0,4));
String currentPathDescription = String("quotes/" + numberRandom + "/description");
String currentPathTitle = String("quotes/" + numberRandom + "/title");

if(dataDay != day(unix_epoch) && dataMonth != month(unix_epoch) && dataYear != year(unix_epoch)){
 String numberRandom = String(random(0,4));
 dataDay = day(unix_epoch);
 dataMonth = month(unix_epoch);
 dataYear = year(unix_epoch);
}

String description=String(Firebase.getString(fbdo,F(currentPathDescription))?fbdo.to<const char*>):fbdo.errorReason).c_str());

String title=String(Firebase.getString(fbdo,F(currentPathTitle))?fbdo.to<const char*>):fbdo.errorReason).c_str());

here is the error

Welcome to the forum

Please do not post pictures of error. Copy the full error using the Copy error message button and paste it here in code tags

Don’t write it this way

Do

String currentPathDescription = String("quotes/") + numberRandom + String("/description");
String currentPathTitle = String("quotes/") + numberRandom + String("/title");

(Of course ideally you would not use the String class)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.