Also, using `trim()` here is inefficient because it creates a new string and then manipulates it to remove the whitespace at start/end, where all you really want to do is to detect if string contains any non-whitespace characters. It's faster to use regex to check for existence of any `\S`.