[GitHub] commons-lang pull request #193: Add isAnyNotEmpty() and isAnyNotBlank() to S...
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/193 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #193: Add isAnyNotEmpty() and isAnyNotBlank() to S...
Github user ptemplier commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/193#discussion_r80358287 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -258,6 +258,35 @@ public static boolean isAnyEmpty(final CharSequence... css) { } /** + * Checks if any one of the CharSequences are not empty ("") or null. + * + * + * StringUtils.isAnyNotEmpty(null) = false + * StringUtils.isAnyNotEmpty(null, "foo") = true + * StringUtils.isAnyNotEmpty("", "bar")= true + * StringUtils.isAnyNotEmpty("bob", "")= true + * StringUtils.isAnyNotEmpty(" bob ", null) = true + * StringUtils.isAnyNotEmpty(" ", "bar") = true + * StringUtils.isAnyNotEmpty("foo", "bar") = true + * + * + * @param css the CharSequences to check, may be null or empty + * @return {@code true} if any of the CharSequences are empty or null + * @since 3.5 + */ +public static boolean isAnyNotEmpty(final CharSequence... css) { + if (ArrayUtils.isEmpty(css)) { +return true; --- End diff -- I took the same behaviour as isAnyBlank()/isAnyEmpty() but maybe those should return false too. It would make more sense. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #193: Add isAnyNotEmpty() and isAnyNotBlank() to S...
Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/193#discussion_r80357934 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -358,6 +387,36 @@ public static boolean isAnyBlank(final CharSequence... css) { } /** + * Checks if any one of the CharSequences are not blank ("") or null and not whitespace only.. + * + * + * StringUtils.isAnyNotBlank(null) = false + * StringUtils.isAnyNotBlank(null, "foo") = true + * StringUtils.isAnyNotBlank(null, null) = false + * StringUtils.isAnyNotBlank("", "bar")= true + * StringUtils.isAnyNotBlank("bob", "")= true + * StringUtils.isAnyNotBlank(" bob ", null) = true + * StringUtils.isAnyNotBlank(" ", "bar") = true + * StringUtils.isAnyNotBlank("foo", "bar") = false + * + * + * @param css the CharSequences to check, may be null or empty + * @return {@code true} if any of the CharSequences are not blank or null or whitespace only + * @since 3.5 + */ +public static boolean isAnyNotBlank(final CharSequence... css) { + if (ArrayUtils.isEmpty(css)) { +return true; --- End diff -- See above --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #193: Add isAnyNotEmpty() and isAnyNotBlank() to S...
Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/193#discussion_r80357925 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -258,6 +258,35 @@ public static boolean isAnyEmpty(final CharSequence... css) { } /** + * Checks if any one of the CharSequences are not empty ("") or null. + * + * + * StringUtils.isAnyNotEmpty(null) = false + * StringUtils.isAnyNotEmpty(null, "foo") = true + * StringUtils.isAnyNotEmpty("", "bar")= true + * StringUtils.isAnyNotEmpty("bob", "")= true + * StringUtils.isAnyNotEmpty(" bob ", null) = true + * StringUtils.isAnyNotEmpty(" ", "bar") = true + * StringUtils.isAnyNotEmpty("foo", "bar") = true + * + * + * @param css the CharSequences to check, may be null or empty + * @return {@code true} if any of the CharSequences are empty or null + * @since 3.5 + */ +public static boolean isAnyNotEmpty(final CharSequence... css) { + if (ArrayUtils.isEmpty(css)) { +return true; --- End diff -- Shouldn't this return false? An empty Array does not contain any non empty CharSequences. WDYT? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #193: Add isAnyNotEmpty() and isAnyNotBlank() to S...
GitHub user ptemplier opened a pull request: https://github.com/apache/commons-lang/pull/193 Add isAnyNotEmpty() and isAnyNotBlank() to StringUtils You can merge this pull request into a Git repository by running: $ git pull https://github.com/ptemplier/commons-lang stringutils-new-methods Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/193.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #193 commit d2871a486271d60d49a557bc1f1d296f5efccf97 Author: Pierre TemplierDate: 2016-09-23T22:49:32Z Add isAnyNotEmpty() and isAnyNotBlank() to StringUtils --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---