[
https://issues.apache.org/jira/browse/LANG-671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981513#action_12981513
]
Niall Pemberton commented on LANG-671:
--------------------------------------
It is a more powerful facility than the StringUtils.containsWhitespace() thats
already been added for LANG-625 and there are three reasons I can think of in
favour of adding this:
* LANG-625 indicates that "the basic loop is 10 times faster than regex" -
though I haven't verified this
* These methods are simpler than regex
* The definition of *whitespace* seems to be different in regexp than the
Character.isWhitespace(char) method - when I tried the changes to
StringUtilsTest I made in the 2.x branch in r1058365 - they failed in the
regexp version of the normalizeSpace() method in trunk (see
http://svn.apache.org/viewvc?view=revision&revision=1058365)
Having said that I think you're idea is a good one. Do you object to having
both?
> Add indexOf() & lastIndexOf() methods for Whitespace and Non-whitespae to
> StringUtils
> -------------------------------------------------------------------------------------
>
> Key: LANG-671
> URL: https://issues.apache.org/jira/browse/LANG-671
> Project: Commons Lang
> Issue Type: New Feature
> Components: lang.*
> Reporter: Niall Pemberton
> Attachments: LANG-671-StringUtils-whitespace.patch
>
>
> Whitespace methods:
> {code}
> public static int indexOfWhitespace(CharSequence str, int startPos)
> public static int lastIndexOfWhitespace(CharSequence str, int startPos)
> {code}
> Non-whitespace methods:
> {code}
> public static int indexOfNonWhitespace(CharSequence str, int startPos)
> public static int lastIndexOfNonWhitespace(CharSequence str, int startPos)
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.