Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ACF2917A23 for ; Mon, 11 May 2015 17:21:18 +0000 (UTC) Received: (qmail 87704 invoked by uid 500); 11 May 2015 17:21:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 87599 invoked by uid 500); 11 May 2015 17:21:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 87585 invoked by uid 99); 11 May 2015 17:21:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 May 2015 17:21:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BC3FDE056A; Mon, 11 May 2015 17:21:12 +0000 (UTC) From: britter To: issues@commons.apache.org Reply-To: issues@commons.apache.org References: In-Reply-To: Subject: [GitHub] commons-lang pull request: LANG-1124: Add StringUtils split by len... Content-Type: text/plain Message-Id: <20150511172112.BC3FDE056A@git1-us-west.apache.org> Date: Mon, 11 May 2015 17:21:12 +0000 (UTC) Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/75#discussion_r30060436 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -3277,6 +3277,164 @@ public static String substringBetween(final String str, final String open, final return list.toArray(new String[list.size()]); } + /** + *

Split a String into an array, using an array of fixed string lengths.

+ * + *

If not null String input, the returned array size is same as the input lengths array.

+ * + *

A null input String returns {@code null}. + * A {@code null} or empty input lengths array returns an empty array. + * A {@code 0} in the input lengths array results in en empty string.

+ * + *

Extra characters are ignored (ie String length greater than sum of split lengths). + * All empty substrings other than zero length requested, are returned {@code null}.

+ * + *
    +     * StringUtils.splitByLength(null, *)      = null
    +     * StringUtils.splitByLength("abc")        = []
    +     * StringUtils.splitByLength("abc", null)  = []
    +     * StringUtils.splitByLength("abc", [])    = []
    +     * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
    --- End diff --
    
    According to ```StringUtils.split(String, char)```this should better return an empty array.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---