commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [2/6] [lang] Extract method for parsing locales from string
Date Mon, 17 Apr 2017 10:52:02 GMT
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 <britter@apache.org>
Authored: Mon Apr 17 12:09:37 2017 +0200
Committer: Benedikt Ritter <britter@apache.org>
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];


Mime
View raw message