sgoeschl commented on a change in pull request #766:
URL: https://github.com/apache/commons-lang/pull/766#discussion_r744933460



##########
File path: src/main/java/org/apache/commons/lang3/LocaleUtils.java
##########
@@ -248,7 +248,9 @@ private static Locale parseLocale(final String str) {
             return new Locale(str);
         }
 
-        final String[] segments = str.split("_", -1);
+        final String[] segments = str.contains("-")
+            ? str.split("-", -1)

Review comment:
       Blame my weak eyes - could we introduce constants here, e.g. 
"UNDERSCORE"?

##########
File path: src/main/java/org/apache/commons/lang3/LocaleUtils.java
##########
@@ -324,7 +327,7 @@ public static Locale toLocale(final String str) {
             throw new IllegalArgumentException("Invalid locale format: " + 
str);
         }
         final char ch0 = str.charAt(0);
-        if (ch0 == '_') {
+        if (ch0 == '_' || ch0 == '-') {

Review comment:
       We could use "UNDERSCORE" or "DASH" here or introduce a helper method, 
e.g. "isDelimiter"? What do you think?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to