Skip to content

Commit

Permalink
fix StringUtils#isBlank (#4725)
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc authored and beiwei30 committed Aug 3, 2019
1 parent 1173b40 commit a8785e9
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,17 @@ public static String replace(final String text, final String searchString, final
return buf.toString();
}

public static boolean isBlank(String str) {
return isEmpty(str);
public static boolean isBlank(CharSequence cs) {
int strLen;
if (cs == null || (strLen = cs.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if (!Character.isWhitespace(cs.charAt(i))) {
return false;
}
}
return true;
}

/**
Expand Down

0 comments on commit a8785e9

Please sign in to comment.