[ 
https://issues.apache.org/jira/browse/LANG-1231?focusedWorklogId=511613&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-511613
 ]

ASF GitHub Bot logged work on LANG-1231:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Nov/20 23:04
            Start Date: 13/Nov/20 23:04
    Worklog Time Spent: 10m 
      Work Description: kinow commented on a change in pull request #644:
URL: https://github.com/apache/commons-lang/pull/644#discussion_r523277032



##########
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##########
@@ -2854,6 +2854,39 @@ public static int indexOfAny(final CharSequence cs, 
final String searchChars) {
         return indexOfAny(cs, searchChars.toCharArray());
     }
 
+    /**
+     * <p>Search a CharSequence to find the first index of any
+     * character in the given set of characters starting with
+     * a given index.</p>
+     *
+     * <p>A {@code null} String will return {@code -1}.
+     * A {@code null} search string will return {@code -1}.</p>
+     *
+     * <pre>
+     * StringUtils.indexOfAny(null, 0, *)            = -1
+     * StringUtils.indexOfAny("", 0, *)              = -1
+     * StringUtils.indexOfAny(*, 0, null)            = -1
+     * StringUtils.indexOfAny(*, 0, "")              = -1
+     * StringUtils.indexOfAny("zzabyycdxx", 0, "za") = 0
+     * StringUtils.indexOfAny("zzabyycdxx", 0, "by") = 3
+     * StringUtils.indexOfAny("aba", 0, "z")         = -1
+     * StringUtils.indexOfAny("aba", 1, "a")         = 1
+     * StringUtils.indexOfAny("aba", -1, "a")        = -1
+     * </pre>
+     *
+     * @param cs  the CharSequence to check, may be null
+     * @param beginIndex  the start position to search
+     * @param searchChars  the chars to search for, may be null
+     * @return the index of any of the chars, -1 if no match,null input or  
the beginIndex smaller than 0
+     * @since 3.12
+     */
+    public static int indexOfAny(final CharSequence cs, int beginIndex, final 
String searchChars) {
+        if (isEmpty(cs) || isEmpty(searchChars) || beginIndex < 0) {
+            return INDEX_NOT_FOUND;
+        }
+        return indexOfAny(cs.toString().substring(beginIndex), 
searchChars.toCharArray());

Review comment:
       Although I think other similar methods make no remarks about 
locales/surrogate pairs... so we can probably ignore what I just said I guess ☺




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 511613)
    Time Spent: 2h  (was: 1h 50m)

> StringUtils#indexOfAny() methods with start position argument
> -------------------------------------------------------------
>
>                 Key: LANG-1231
>                 URL: https://issues.apache.org/jira/browse/LANG-1231
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.4
>            Reporter: Guram Savinov
>            Priority: Minor
>              Labels: string
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> There is no StringUtils#indexOfAny() methods with start position argument, 
> which would search for specified characters from the specified position.
> Please add it.



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

Reply via email to