How to filter a blank line received over serial - ESP8266
inData.trim();
if( inData.length() &gt; 0 ){
   Serial.println("Got: " + inData + "\n");


::trim() removes all leading and trailing whitespace characters including newlines. A line of [zero or more whitespace] + [newline] will get trimmed to the null string. If the result isn't null, then append the stripped off newline and print it. Note that this will flatten any indentation or vertical spacing that was supplied in the incoming text.