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 2009/02/28 22:00:12 UTC

[jira] Commented: (LANG-469) Commons-lang StringUtils head, tail and indexOfNth (with patch)

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

Henri Yandell commented on LANG-469:
------------------------------------

My main concern with head and tail are that they bake in the newline concept. I agree that they're semantically nice, but there's an unwritten agreement on what a 'line' is there.

Implementation wise, I think it's the same as:

StringUtils.join( ArrayUtils.subarray( StringUtils.split("\n"), 0, 3 ), "\n" )

I'm pondering whether these fit better in WordUtils; though that's more a lesson that WordUtils should have been TextUtils - namely a class that understands that a string's structure has meaning.

---

I like indexOfNth as a name. Those methods seem useful.


> 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
>             Fix For: 3.0
>
>         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.