[jira] [Commented] (LANG-899) StringUtils lastIndexOf(String str, char searchChar, int startPos) not working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (LANG-899) StringUtils lastIndexOf(String str, char searchChar, int startPos) not working

Gary D. Gregory (Jira)

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

Sebb commented on LANG-899:
---------------------------

Looks to me that this is the intended behaviour.

The startPos is perhaps misnamed; the search works backwards from the index.

So it should not find a match for characters after the startPos.

It will only search the whole string if you provide a startIndex >= to the max index in the string, i.e. length -1.

The documentation (and examples) could be improved.
               

> StringUtils lastIndexOf(String str, char searchChar, int startPos) not working
> ------------------------------------------------------------------------------
>
>                 Key: LANG-899
>                 URL: https://issues.apache.org/jira/browse/LANG-899
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.4
>            Reporter: Adrien Berthou
>
> returns -1 when I call this method on a Sting with a char present after the startPos indicated
> not sure if it's been fixed in more recent version of the library. I have not seen any JIRA ticket regarding this issue though

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira