title: String Comparison Not working Arduino
body: <p>Could somebody explain what is wrong with this code. WHY is the if statement always false when it is matching the exact strings..I have tried it with == as well..Still, every time I am getting No Match Found !!.</p>
  
  <pre><code>String inData = "";
  char inChar;
  String property;  
  String a = "test";
  
  void loop() {
  
  
    Serial.println("String Comparison"); 
  
    if(Serial.available() &gt; 0){
  
          while(Serial.available()&gt;0) {
            inChar = Serial.read();
            inData.concat(inChar);
          }
  
          //Extracting Property
          property = inData.substring(inData.lastIndexOf(":")+2); // Extracts the String "test"
          Serial.println("Property:" +property);
  
  
          if(property.equals(a)){ // It never matches though, it is TRUE all the time
  
             Serial.println(" Matched !! ");
  
          }      
          else
          Serial.println(" Match Not Found !! ");
  
         inData = "";
  
  
     }
  
    delay(5000);
  }
  </code></pre>