Since you are using the String class the trim() function may be of interest. The trim() function can remove any white space characters (\n \r) from the serial input.
Since you are using the String class the trim() function may be of interest. The trim() function can remove any white space characters (\n \r) from the serial input.