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 2010/02/07 08:26:27 UTC

[jira] Issue Comment Edited: (LANG-510) Convert StringUtils API to take CharSequence

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

Henri Yandell edited comment on LANG-510 at 2/7/10 7:25 AM:
------------------------------------------------------------

Played with changing left/right/mid. Issue here, same substring will have, is that it changes the method from String left(String) to CharSequence left(CharSequence) due to the reliance on subSequence.

That means using code is going to have to start casting. Ugh. That will be a general issue for any String manipulation as opposed to query API. For these methods we are going to need to do overloads:

{code:java}
    String doFoo(String)
    
    CharSequence doFoo(CharSequence)
{code}

Smells likely to be copy and paste code. Ugh again.

UPDATE: Must be late... this is generics territory :)

      was (Author: bayard):
    Played with changing left/right/mid. Issue here, same substring will have, is that it changes the method from String left(String) to CharSequence left(CharSequence) due to the reliance on subSequence.

That means using code is going to have to start casting. Ugh. That will be a general issue for any String manipulation as opposed to query API. For these methods we are going to need to do overloads:

{code:java}
    String doFoo(String)
    
    CharSequence doFoo(CharSequence)
{code}

Smells likely to be copy and paste code. Ugh again.
  
> Convert StringUtils API to take CharSequence
> --------------------------------------------
>
>                 Key: LANG-510
>                 URL: https://issues.apache.org/jira/browse/LANG-510
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: Henri Yandell
>             Fix For: 3.0
>
>         Attachments: LANG-510-indexOf.patch
>
>
> Wherever possible, use CharSequence and not String in the StringUtils API.
> substring can go to subSequence inside code. The general substring method can be replaced with a subSequence method and substring deprecated(?). One question is whether to implement a CharSequence.indexOf type method. Given that it's merely a walking method(?!?), this might be quite handy and would allow a bunch of StringUtils methods to move over.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.