-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
1.1.6, 1.2.2
-
generic
-
generic
Name: vi73552 Date: 05/19/99
The java.util.Locale class should have a constructor that takes a string representation of a Locale (The string representation is language underscore country underscore variant)
When I have a string representation I have to parse it and pass each part separately.
(Review ID: 83259)
======================================================================
4291668 suggests a method Locale.valueOf for the same problem:
public static Locale valueOf(String s) {
String language = "";
String country = "";
String variant = "";
int i = s.indexOf('_');
if (i < 0) {
language = s;
} else {
language = s.substring(0, i);
int j = s.indexOf('_', i + 1);
if (j < 0) {
country = s.substring(i + 1);
} else {
country = s.substring(i + 1, j);
variant = s.substring(j + 1);
}
}
return new Locale(language, country, variant);
}
- duplicates
-
JDK-4291668 RFE: Want Locale.valueOf(String) method
-
- Closed
-