user28133: I am very new to Arduino Programming. 
I am trying to identify the input string from serial monitor and printing the output to the console accordingly 
Code is :
void setup() {
       Serial.begin(9600);
}

void loop() {

   while (Serial.available() > 0 ) {

     String str = Serial.readString();

     if (str.equals("send")) {
        Serial.println("identified");
     } else {
        Serial.println("unknown");
     }

   }

}

Whenever i put send string it is showing "unknown" as the output, which is wrong, and i should get "identified" as the output.
Can anyone guide me here to achieve the result.
Note : I am getting output as i wanted by using readStringUntil function but the strings has a lot of "." in it, hence not useful.

user37523: If you set your Serial Monitor's line ending to "Both NL & CR", then this code will find the word "send". It will NOT find the word "send" in this string, "ssend" or in this string, "sendd".
void setup(){
  Serial.begin(9600);
}

void loop(){
  while(Serial.available() > 0 ){
    String str = Serial.readString();
    if(str.substring(0) == "send\r\n"){
      Serial.println("identified");} 
    else{
      Serial.println("unknown");
    }
  }
}

If you want to find the string "send" in "1234send" or "send1234" or "1234send5678" then use indexOf();
void setup(){
  Serial.begin(9600);
}

void loop(){
  while(Serial.available() > 0 ){
    String str = Serial.readString();
    if(str.indexOf("send") > -1){
      Serial.println("identified");} 
    else{
      Serial.println("unknown");
    }
  }
}


28133: <p>I am very new to Arduino Programming. 
I am trying to identify the input string from serial monitor and printing the output to the console accordingly </p>

<p>Code is :</p>

<pre><code>void setup() {
       Serial.begin(9600);
}

void loop() {

   while (Serial.available() &gt; 0 ) {

     String str = Serial.readString();

     if (str.equals("send")) {
        Serial.println("identified");
     } else {
        Serial.println("unknown");
     }

   }

}
</code></pre>

<p>Whenever i put send string it is showing "unknown" as the output, which is wrong, and i should get "identified" as the output.
Can anyone guide me here to achieve the result.</p>

<p>Note : I am getting output as i wanted by using readStringUntil function but the strings has a lot of "." in it, hence not useful.</p>
 37523: <p>If you set your Serial Monitor's line ending to "Both NL &amp; CR", then this code will find the word "send". It will NOT find the word "send" in this string, "ssend" or in this string, "sendd".</p>

<pre><code>void setup(){
  Serial.begin(9600);
}

void loop(){
  while(Serial.available() &gt; 0 ){
    String str = Serial.readString();
    if(str.substring(0) == "send\r\n"){
      Serial.println("identified");} 
    else{
      Serial.println("unknown");
    }
  }
}
</code></pre>

<p>If you want to find the string "send" in "1234send" or "send1234" or "1234send5678" then use indexOf();</p>

<pre><code>void setup(){
  Serial.begin(9600);
}

void loop(){
  while(Serial.available() &gt; 0 ){
    String str = Serial.readString();
    if(str.indexOf("send") &gt; -1){
      Serial.println("identified");} 
    else{
      Serial.println("unknown");
    }
  }
}
</code></pre>
