[
https://issues.apache.org/jira/browse/LANG-469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647654#action_12647654
]
kalecser edited comment on LANG-469 at 11/14/08 8:40 AM:
------------------------------------------------------------------------
Yes, of course I can!
It works just like indexOfNth but starting from the end of the string.
StringUtils.lastIndexOfNth("foo,bar,baz", ",", 2); //will return 3, the second
time comma "," appears starting from the end of the string
I've used it in the tail function to determine from wich index should the
string be returned.
Maybe the method name should be changed to lastIndexOfOccurrence. Do you think
it would get easier to understand that way?
was (Author: kalecser):
Yes, of course I can!
It works just like indexOfNth but starting from the end of the string, for
example:
StringUtils.lastIndexOfNth("foo,bar,baz", ",", 2); //will return 3, the second
time comma "," starting from the end of the string
I've used it in the tail function to determine from wich index should the
string be returned.
Maybe the method name should be changed to lastIndexOfOcurrence. Do you think
it would get easier to understand that way?
> Commons-lang StringUtils head, tail and indexOfNth (with patch)
> ---------------------------------------------------------------
>
> Key: LANG-469
> URL: https://issues.apache.org/jira/browse/LANG-469
> Project: Commons Lang
> Issue Type: Improvement
> Reporter: Kalecser Pasquali Kurtz
> Priority: Minor
> Attachments: StringUtils_head_tail_indexofnth.diff
>
>
> Hello commons developers,
> I would like to propose the addition of these four methods to StringUtils
> class:
> public static String head(final String str, int lines)
> public static String tail(String str, int lines)
> public static int indexOfNth(String str, String searchStr, int occurrence)
> public static int lastIndexOfNth(String str, String searchStr, int occurrence)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.