mirror of
https://github.com/shekhargulati/strman-java.git
synced 2026-10-18 21:43:47 +00:00
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:
committed by
Shekhar Gulati
parent
cf1d373442
commit
d04e679b07
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user