Hello I have an Arduino programme where a string is loaded from an SD card. That all works fine. I want to see if the string that has been loaded contains a certain phrase. I am using substring but it doesn't seem to be working. What am I doing wrong? Here's my code:
file = SD.open("/classes/basic.txt", FILE_READ);
Serial.print("Reading, Checking and Compiling \n");
while(file.available()) {
character23 = file.read();
content.concat(character23);
}
if (content != "") {
l1 = content;
Serial.println(l1 + "\n");
}
if(l1.substring(0) == "print"){
printlnMethod();
}
file.close();
it all works until it gets to l1.substring and that doesn't work because the method inside doesn't run. The string that gets loaded into the Arduino from the SD card is : println("hello world");
What am I doing wrong?