commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalecser Pasquali Kurtz (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-469) Commons-lang StringUtils head, tail and indexOfNth (with patch)
Date Fri, 14 Nov 2008 16:34:44 GMT

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

Kalecser Pasquali Kurtz commented on LANG-469:
----------------------------------------------

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.


Mime
View raw message