For Loop: HTML header indexOf(string + variable + string)

I am trying to indexof() the address of my webserver that is changed by checkboxes on the webpage.

For example: if I press checkbox 1, either GET /c1/1 or GET /c1/0 (depending on the state of the boxwhen pressed) is added to the address. When I print cON to the serial monitor when x=1, it displays "GET /c1/1" but the if statement does not get satisfied.

However, when I modify the code and substitute "GET /c1/1" in for cON or "GET /c1/0" for cOFF, the if statement is able to be satisfied.

for (int x = 1; x <= 10; x++) {
    String cON = "\"GET /c" + String(x) + "/1\"";
    String cOFF = "\"GET /c" + String(x) + "/0\"";
    Serial.println(cON);
    Serial.println(cOFF);
    if (header.indexOf(cON) >= 0) {
      Serial.println(cON);
      Serial.println(cOFF);
      A_c[x] = 1;
    } else if (header.indexOf(cOFF) >= 0) {
      Serial.println(cON);
      Serial.println(cOFF);
      A_c[x] = 0;
    }
  }

If anyone has any insight into why I am able to validate the if statement when it reads:

if (header.indexOf("GET /c1/1") >= 0)

but am not able to validate it when it reads:

 String cON = "\"GET /c1/1\""
if (header.indexOf(cON) >= 0)

I really appreciate any help.

Thanks,
James

String cON = "\"GET /c1/1\""
if (header.indexOf(cON) >= 0)

Results in cON being ""GET /cq1/1"" So you add extra " on both ends which are not in header.
try

String cON = "GET /c1/1";   // there was a ; missing btw.

Thank you for the reply!

Ill give it a try!

Thanks,
James