How to get Locale from its String representation in Java?
        Posted  
        
            by Joonas Pulakka
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Joonas Pulakka
        
        
        
        Published on 2010-03-26T09:47:19Z
        Indexed on 
            2010/03/26
            9:53 UTC
        
        
        Read the original article
        Hit count: 542
        
Is there a neat way of getting a Locale instance from its "programmatic name" as returned by Locale's toString() method? An obvious and ugly solution would be parsing the String and then constructing a new Locale instance according to that, but maybe there's a better way / ready solution for that?
The need is that I want to store some locale specific settings in a SQL database, including Locales themselves, but it would be ugly to use serialized Locale objects there. I would rather store their String representations, which seem to be quite adequate in detail.
© Stack Overflow or respective owner