It works fine, but i was looking for a "if string contains" function.
That's what the indexOf() method does.
if (readString.startsWith("off", 2)) {
Why are you skipping the first 2 characters?
Perhaps the trim() method is of interest, too. Carriage return and line feed are white space.