Faster check for trailing whitespace