Tests if a CharSequence is NOT null, empty, or contains only whitespace. @param s the CharSequence to check @return false if a CharSequence is null, empty, or contains only whitespace
(final CharSequence s)
| 129 | * @return false if a CharSequence is null, empty, or contains only whitespace |
| 130 | */ |
| 131 | public static boolean isNotBlank(final CharSequence s) { |
| 132 | if (s == null) { |
| 133 | return false; |
| 134 | } |
| 135 | |
| 136 | final int length = s.length(); |
| 137 | if (length == 0) { |
| 138 | return false; |
| 139 | } |
| 140 | |
| 141 | for (int i = 0; i < length; i++) { |
| 142 | if (!Character.isWhitespace(s.charAt(i))) { |
| 143 | return true; |
| 144 | } |
| 145 | } |
| 146 | return false; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * @param expected the char that we expect |