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:25:00 UTC

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

     [ https://issues.apache.org/jira/browse/LANG-1640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Samael Bate closed LANG-1640.
-----------------------------
    Resolution: Not A Problem

ignore this. missed that isAnyEmpty actually covers this already

> 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
>            Priority: Major
>
> 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)