You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Samael Bate (Jira)" <ji...@apache.org> on 2021/01/15 19:22:00 UTC

[jira] [Created] (LANG-1640) please add StringUtils.isAnyNull method

Samael Bate created LANG-1640:
---------------------------------

             Summary: please add StringUtils.isAnyNull method
                 Key: LANG-1640
                 URL: https://issues.apache.org/jira/browse/LANG-1640
             Project: Commons Lang
          Issue Type: New Feature
            Reporter: Samael Bate


isAnyBlank and isAnyEmpty are helpful but today I've encountered and issue where I am actually happy to have empty strings but need to ensure none of the String values in my array are null. 

I'd like to check for:

{noformat}
String[] strings = new String[] { "", null, " ", "fine"};

StringUtils.isAnyNull(strings);
{noformat}

Perhaps worth adding:

{noformat}
    public static boolean isAnyNull(final CharSequence... css) {
      if (ArrayUtils.isEmpty(css)) {
        return false;
      }
      for (final CharSequence cs : css) {
        if (cs == null) {
          return true;
        }
      }
      return false;
    }
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)