[
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]