Issued using substring(), indexOf() while using Serial

I don't know much about serial communication in the arduino board. I am having some issues while using the substring() command and indexOf() command.

String command;

void setup(){
  Serial.begin(38400);
  Serial.println("Hi");
}

void loop(){
  if(Serial.available()>0){
    delay(5);
    char c=Serial.read();
    command+=c;
    Serial.println(command.indexOf('l'));
    if(command.substring(0)=="Update"){
      Serial.println("Update...");
      if(command.substring(7)=="color"){
        Serial.println("Updated");
      }
    }
    command="";
  }
  command="";
}

Practically what the user must do is he must type "Update color" and according to code some things are supposed to happen but they never are. Moreover, I have noticed that when I was suppose to get the the Index of 'l' the output are as follows:

Hi
-1
-1
-1
-1
-1
-1
-1
-1
-1
0
-1
-1

The things in the substring statements are not being carried out why?

So whatever you send does not contain a '1'.

I guess that subString(0) is quite useless as it returns the full String and if you send Update color , that will never match Update

Get rid of the String class and start using C strings instead. You can find a list of the string processing functions here.

This test program gives an idea of how to use them.

char command[20];

void setup(){
  Serial.begin(38400);
  Serial.println("Hi");
}

void loop(){
  char *ptr;
  int charsRead;
  if(Serial.available()>0){
                                          // Test with "Update color"
    charsRead = Serial.readBytesUntil('\n', command, sizeof(command) - 1);
    command[charsRead] = NULL;
    ptr = strchr(command, 'l');           // that's an el, not a one
    if (ptr) 
      Serial.println(ptr);
    ptr = strstr(command, "Update");
    if(ptr)
      Serial.println(ptr);
    ptr = strstr(command, "color");
    if(ptr){
        Serial.println(ptr);
    }
  }
  command[0] = NULL;
}