How to ignore case on

Hi, I'm trying to create an IoT project for school and it's controlled via SMS. I want to send a message from my phone to control the lights to switch on and off but also, I want it to ignore the cases. Like "ON" is also "on" or "On" or "oN'. Please help me and thank you in advance.

if(textMessage.indexOf("ON")>=0)
  {
    digitalWrite(lamp, HIGH);
    lampState = "ON";
    Serial.println("Lamp set to ON\r\n");  
    textMessage = "";
    
    delay(500);
    Serial.print("Lamp was finally switched ON.\r");
    delay(1000);
  }

Have you looked at the String class methods? Do the names toUpperCase() or toLowerCase() suggest anything to you?

I saw this one:

string.equalsIgnoreCase(string2)

but I'm not sure where to put it tho.

reuroo:
I saw this one:

string.equalsIgnoreCase(string2)

but I'm not sure where to put it tho.

I'd suggest where to put it, but it is NOT an appropriate function to be using.

You are not testing that the String IS "ON", "on", On", or "oN". You are testing that the String contains "ON", "on", On", or "oN", which you could do by converting the String to upper case, and looking for the index of "ON". Or, convert to lower case, and look for "on".