This surely has been asked before, but Googling doesn’t find it. Is there, in any of the standard java libraries (including apache/google/…), a static isNullOrEmpty() method for Strings?
This surely has been asked before, but Googling doesn’t find it . Is there,
Share
StringUtils.isEmpty(str)orStringUtils.isNotEmpty(str)StringUtils.isBlank(str)orStringUtils.isNotBlank(str)from Apache commons-lang.
The difference between
emptyandblankis : a string consisted of whitespaces only isblankbut isn’tempty.I generally prefer using apache-commons if possible, instead of writing my own utility methods, although that is also plausible for simple ones like these.