Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CF40E200C6B for ; Mon, 17 Apr 2017 12:52:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CE09A160BB2; Mon, 17 Apr 2017 10:52:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 23547160BAB for ; Mon, 17 Apr 2017 12:52:03 +0200 (CEST) Received: (qmail 70641 invoked by uid 500); 17 Apr 2017 10:52:03 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 70594 invoked by uid 99); 17 Apr 2017 10:52:01 -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, 17 Apr 2017 10:52:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 31F59E00B4; Mon, 17 Apr 2017 10:52:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: britter@apache.org To: commits@commons.apache.org Date: Mon, 17 Apr 2017 10:52:02 -0000 Message-Id: <8af38f7388f745938f334bc9f41acf5e@git.apache.org> In-Reply-To: <983ce83d08174ee6b691e78721fa0ab1@git.apache.org> References: <983ce83d08174ee6b691e78721fa0ab1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/6] [lang] Extract method for parsing locales from string archived-at: Mon, 17 Apr 2017 10:52:05 -0000 Extract method for parsing locales from string Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/d547412b Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/d547412b Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/d547412b Branch: refs/heads/master Commit: d547412bbd2a1ca56769a2bfa13b7ed9547310ca Parents: 3c89994 Author: Benedikt Ritter Authored: Mon Apr 17 12:09:37 2017 +0200 Committer: Benedikt Ritter Committed: Mon Apr 17 12:09:37 2017 +0200 ---------------------------------------------------------------------- src/main/java/org/apache/commons/lang3/LocaleUtils.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d547412b/src/main/java/org/apache/commons/lang3/LocaleUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java index a2f01ec..09479f6 100644 --- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java +++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java @@ -123,6 +123,10 @@ public class LocaleUtils { return new Locale(StringUtils.EMPTY, str.substring(1, 3), str.substring(4)); } + return parseLocale(str, len); + } + + private static Locale parseLocale(final String str, final int len) { final String[] segments = str.split("_", -1); final int segmentCount = segments.length -1; final String country = segments[0];