You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2015/11/16 20:20:11 UTC

[jira] [Resolved] (LANG-1182) Clarify JavaDoc of StringUtils.containsAny()

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

Benedikt Ritter resolved LANG-1182.
-----------------------------------
    Resolution: Fixed
      Assignee: Benedikt Ritter

{code}
commit 56907c9a96a50af44415111fcea3e76ce4d1890f
Merge: 4811375 7f0d6b4
Author: Benedikt Ritter <br...@apache.org>
Date:   Mon Nov 16 20:16:52 2015 +0100

    Merge branch 'LANG-1182'

    LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
    Larry West for the suggestion and to Pascal Schuhmacher for implementing
    it. This fixes #114 from github.
{code}

> Clarify JavaDoc of StringUtils.containsAny()
> --------------------------------------------
>
>                 Key: LANG-1182
>                 URL: https://issues.apache.org/jira/browse/LANG-1182
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.4
>            Reporter: Larry West
>            Assignee: Benedikt Ritter
>            Priority: Minor
>             Fix For: 3.5
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> (1) The javadoc for StringUtils.containsAny(CharSequence cs, CharSequence... searchCharSequences) confusingly says 
>      * StringUtils.containsAny("abcd", "ab", "cd") = false
> You can verify this actually returns true by running this:
>         if (!StringUtils.containsAny("abcd", "ab", "cd")) 
>             throw new AssertionError("Third sample from StringUtils 3.4 javadoc");
> (2) The javadoc for containsAny(final CharSequence cs, final CharSequence searchChars) is inadequate, and could easily mislead naive readers to believe this containsAny() looks for a matching sequence (substring) rather than characters in a set:
>      * StringUtils.containsAny("zzabyycdxx", "za") = true
>      * StringUtils.containsAny("zzabyycdxx", "by") = true
> In other words, both examples would be equally true for StringUtils.contains().  I suggest adding clarifying examples, like:
>       * StringUtils.containsAny("zzabyycdxx", "\tx") = true
>       * StringUtils.containsAny("zzabyycdxx", "$.#yF") = true



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)