You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2007/04/04 17:45:32 UTC

[jira] Created: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
------------------------------------------------------------------------------------------------------------------------------------

                 Key: LANG-326
                 URL: https://issues.apache.org/jira/browse/LANG-326
             Project: Commons Lang
          Issue Type: New Feature
    Affects Versions: 2.3
            Reporter: Niall Pemberton


I'd like the following new start/end methods for StringUtils:

  startsWith - handles nulls
  endsWith - handles nulls
  startsWithIgnoreCase - handles nulls, case insensitive
  endsWithIgnoreCase - handles nulls, case insensitive

  removeStartIgnoreCase - handles nulls, case insensitive
  removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489332 ] 

Stephen Colebourne commented on LANG-326:
-----------------------------------------

Is there a role for CaseInsensitiveStringUtils instead? How many of these methods need adding?

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-326:
---------------------------------

    Attachment: LANG-326-Start-End-With-2.patch

Apologies - hadn't refreshed my local copy before creating previous patch - new patch provided

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-326:
---------------------------------

    Fix Version/s: 3.0
         Priority: Minor  (was: Major)

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-326:
---------------------------------

    Attachment:     (was: LANG-326-Start-End-With.patch)

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509246 ] 

Niall Pemberton commented on LANG-326:
--------------------------------------

OK patch applied - just noticed the fix version is 3.0 - is that the next planned release? - I've used @since Lang 2.4 in the JavaDoc for new methods

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509270 ] 

Stephen Colebourne commented on LANG-326:
-----------------------------------------

Personally, I would go with 2.4.

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508854 ] 

Niall Pemberton commented on LANG-326:
--------------------------------------

Its been a while since I posted this - in the absence of anyone stepping with alternatives [CaseInsensitiveStringUtils /  Collators] I plan to commit this unless someone objects

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Stephen Kestle (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508943 ] 

Stephen Kestle commented on LANG-326:
-------------------------------------

I'm fine with it - at a later point these methods could be re-plumbed to use collators, and other methods added (I'll probably do it when I actually start using collators for real).

As a side question, how much do we care about speed and [premature?] optimization? if I were to "upgrade" and overload these methods, would it be a problem to create Collator objects for the existing defaults and use a modified algorithm to do the evaluation?  I'd presume the str.regionMatches() would be faster by a few picos, but I prefer brevity, as well as indication of the "correct" (international) way.

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508954 ] 

Niall Pemberton commented on LANG-326:
--------------------------------------

I implemented these methods using str.regionMatches() with brevity and correctness in mind and not optimization.

Looking at other existing "case insensitive" String comparrison implementations in StringUtils - they achieved brevity by using str.toUpperCase() and then calling the "case sensitive" flavour of the method. IMO these are not quite correct since the case insensitive functionality provided by the String class (which IMO StringUtils should be compatible with) do more than that (with a comment that upper case comparison has issues with the Georgian alphabet). Using regionMatches() allowed the same code to be (re-)used for both the case sensitive and insensitive implementations and for them to be compatible with the case insensitive functionality provided by String. So optimization was just a nice by-product.

On your Collator implementation IMO it would be better as a new utility class for those that need that functionality (I18NStringUtils?) - which would give people a choice and ties in nicely with what java provides - i.e. a choice of 2 different mechanisms.

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-326:
---------------------------------

    Attachment: LANG-326-Start-End-With.patch

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509193 ] 

Stephen Colebourne commented on LANG-326:
-----------------------------------------

I'm happy for these ignoreCase methods to be added. For collators I'd suggest a CollatorUtils.

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (LANG-326) StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489469 ] 

Niall Pemberton commented on LANG-326:
--------------------------------------

Theres already case-insensitive equals and contains - potentially theres a number of other candidates (e.g. indexOf, lastIndexOf, remove, replace) - but I don't haven't had a use for them so far. Stephen Kestle also raised the point that for other Locale case insensitivity should use a Collator - see http://tinyurl.com/3d2jjk and LANG-316.

I guess for either CaseInsensitiveStringUtils or using Collators it needs someone willing to do the work.

> StringUtils: startsWith / endsWith / startsWithIgnoreCase / endsWithIgnoreCase / removeStartIgnoreCase / removeEndIgnoreCase methods
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-326
>                 URL: https://issues.apache.org/jira/browse/LANG-326
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-326-Start-End-With-2.patch
>
>
> I'd like the following new start/end methods for StringUtils:
>   startsWith - handles nulls
>   endsWith - handles nulls
>   startsWithIgnoreCase - handles nulls, case insensitive
>   endsWithIgnoreCase - handles nulls, case insensitive
>   removeStartIgnoreCase - handles nulls, case insensitive
>   removeEndIgnoreCase - handles nulls, case insensitive

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org