You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2011/07/20 10:34:57 UTC

[jira] [Commented] (LANG-622) StringUtils.lastIndexOfAnyBut() function desired

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

Henri Yandell commented on LANG-622:
------------------------------------

One to do for 3.0.1 now that 3.0 is out the door.

Looking at the patch, it seems wasteful. Rather than using lastIndex, you use indexOf repeatedly until you've reached the end. Cute, but I'd hope we can do something quicker. 

Test looks good and passes. Note the todo item to add supplementary character tests. Probably worth a few 'working well' tests as well. Current tests focus on boundary conditions and error values.

> StringUtils.lastIndexOfAnyBut() function desired
> ------------------------------------------------
>
>                 Key: LANG-622
>                 URL: https://issues.apache.org/jira/browse/LANG-622
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: david cogen
>            Priority: Minor
>             Fix For: 3.0.1
>
>         Attachments: LANG-622.patch, StringUtilslLastIndexOfAnyButTest.java
>
>
> class StringUtils needs the function lastIndexOfAnyBut()
> This would be like indexOfAnyBut() except searches from the end rather than the beginning.
> It would be like lastIndexOfAny() except looks for a character other than those in the string rather than for those in the string.
> This is the only one of the four combinations of "from beginning"/"from end" and "for any"/"for any but" that is not provided.
> Interestingly, the class header doc. mentions "LastIndexOfAnyBut" but the function does not exist - even as a private, as determined by class introspection.
> (This is not a frivolous request. I actually did need this function and ended up having to code a search loop.)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira