Check whether a string is empty or whitespace.
Time complexity: O(1)
Space complexity: O(1)
String to check
Whether the string is whitespace
String
isWhitespace(' \n '); // true Copy
isWhitespace(' \n '); // true
isWhitespace(''); // true Copy
isWhitespace(''); // true
Check whether a string is empty or whitespace.
Time complexity: O(1)
Space complexity: O(1)