[ 
https://issues.apache.org/jira/browse/LANG-445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633178#action_12633178
 ] 

Sebb commented on LANG-445:
---------------------------

Added commons-lang-startsWithAny2 to SVN trunk:

URL: http://svn.apache.org/viewvc?rev=697715&view=rev
Log:
LANG-445 - new method StringUtils.startsWithAny(String str, String[] searchStrs)

Modified:
   commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
   
commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringUtilsTest.java

Had to fix a Javadoc bug - parameter is called searchStrings, not searchString.
Also added another False test to ensure all the substrings are checked.

> Method "startsWithAny(String str, String[] searchStrs)"
> -------------------------------------------------------
>
>                 Key: LANG-445
>                 URL: https://issues.apache.org/jira/browse/LANG-445
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Sven Schliesing
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: commons-lang-startsWithAny.patch.txt, 
> commons-lang-startsWithAny2.patch.txt
>
>
> Similar to 
> http://commons.apache.org/lang/apidocs/org/apache/commons/lang/StringUtils.html#indexOfAny(java.lang.String,%20java.lang.String[])
> To replace
> ----------
> if (StringUtils.startsWith(foo, "bar") || StringUtils.startsWith(foo, "baz") 
> || ...) [...]
> ----------
> with
> ----------
> if (StringUtils.startsWithAny(foo, new String[] {"bar", "baz", ...})) [...]
> ----------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to