Hey so I’m trying to do some string manipulation in a cloud function since you can only pass in a string argument. I’m decently new to the Particle IDE so I’m probably making some dumb mistakes but I just need more eyes on it. Is there possibly a library I need to include for this to work? Am I naming the functions wrong? Anything would be helpful! Thanks!
int save(String obj){ //save object with name passed in to EEPROM
//string obj saved in form name/fuzz/vol
int first= obj.find('/');
int sec= obj.find_last_of('/');
//splice the string "obj" into a string an two doubles using substrings and the c++ function stod
String name= obj.substr(0, first);
double vol= stod(obj.substr((first+1), sec));
double fuzz= stod(obj.substr(sec+1));
//you can stop reading here, this is the end of the string manipulation, I just copied over the whole function.
const int count= 1;
if(count==1){
P1.changeAll(name, vol, fuzz);
EEPROM.put(addr1, P1);
}else if(count==2){
P2.changeAll(name, vol, fuzz);
EEPROM.put(addr2, P2);
}else if(count==3){
P3.changeAll(name, vol, fuzz);
EEPROM.put(addr3, P3);
}else if(count==4){
P4.changeAll(name, vol, fuzz);
EEPROM.put(addr4, P4);
}else if(count==5){
P5.changeAll(name, vol, fuzz);
EEPROM.put(addr5, P5);
}else{
return -1;
}
count++;
return 1;
}
When I verify it gives me errors that none of the string functions I’m using exist and that stod hasn’t been initialized at all. I know its probably something really dumb I’m just sick of stewing over it. Thanks!