Checks if a String is whitespace, empty ("") or null. StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false @param str the String to check
(String str)
| 261 | * @since 2.0 |
| 262 | */ |
| 263 | public static boolean isBlank(String str) { |
| 264 | int strLen; |
| 265 | if (str == null || (strLen = str.length()) == 0) { |
| 266 | return true; |
| 267 | } |
| 268 | for (int i = 0; i < strLen; i++) { |
| 269 | if ((Character.isWhitespace(str.charAt(i)) == false)) { |
| 270 | return false; |
| 271 | } |
| 272 | } |
| 273 | return true; |
| 274 | } |
| 275 | |
| 276 | // Count matches |
| 277 | // ----------------------------------------------------------------------- |
no test coverage detected