commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <>
Subject [jira] [Updated] (LANG-910) Patch to extend StringUtils
Date Sun, 13 Oct 2013 10:06:42 GMT


Henri Yandell updated LANG-910:

    Attachment: LANG-910.patch

I cleaned up the javadoc and added another method:

public static String[] substringsMatches(final String str, Pattern pattern) {

Then hit some pain because there is only one matching group in "(.)" in Java :(

I've attached my patch. My only concern is whether we should be addressing the above. 

Should we provide an API that works more naturally such that there are 6 matching groups in
"foobar"->match("(.)") instead of only one? Then you can say substring(4) and get "bar"
back (noting matching groups are 1-indexed and not 0-indexed?

> Patch to extend StringUtils
> ---------------------------
>                 Key: LANG-910
>                 URL:
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.1
>         Environment: Developed on Ubuntu 13.04 with openjdk 7u25
>            Reporter: Timur Yarosh
>              Labels: patch
>             Fix For: 3.2
>         Attachments: LANG-910.patch, substring-matches-and-white-space-normalize.patch
> This patch extends StringUtils capabilities: added methods to find substring(s) by Pattern.
Also method org.apache.commons.lang3.StringUtils#normalizeSpace now replaces ASCII #160 char
to normal whitespace.

This message was sent by Atlassian JIRA

View raw message