New emptyOrSpaces() utility method