If statement not working

I have a if statement that is not working, code below, any ideas? Seria.print(key) outputs the value 1

void KeyPress(char key, String state) // Assign action to key# & state#
{
   if (key == 1){
     Serial.print(key);
     Serial.print(" ");
     Serial.println(state);
   }
}

(deleted)

What did you expect? You test if (key ==1) then you print the variable key. Output will sure be 1

What gets printed? [color=red]'[/color]1[color=red]'[/color] or 1

that is the question...

I managed to fix it, mistake on my part. :confused: