Adding isBlank method (#89)

* added isBlank method, along with junit test and readme update

* removing local files

* adding gitignore with Eclipse specific files ignored

* removed unused imports from Strman.java and split tests out to match current test convention
This commit is contained in:
Andy Deese
2017-05-20 06:57:21 +05:30
committed by Shekhar Gulati
parent cf1d373442
commit d04e679b07
4 changed files with 44 additions and 2 deletions
+11
View File
@@ -1305,6 +1305,16 @@ public abstract class Strman {
.mapToObj(c -> (char) c)
.collect(groupingBy(identity(), counting()));
}
/**
* Checks if string is empty. This is a null safe check and will return true when string is null.
*
* @param input The input string
* @return true if string is null or empty
*/
public static boolean isBlank(String input) {
return input == null || input.isEmpty();
}
private static void validate(String value, Predicate<String> predicate, final Supplier<String> supplier) {
if (predicate.test(value)) {
@@ -1325,5 +1335,6 @@ public abstract class Strman {
}
return countSubstr(value.substring(offset), subStr, allowOverlapping, ++count);
}
}