Class LocaleUtils


  • public class LocaleUtils
    extends java.lang.Object
    Utilities for for dealing with Locale objects
    • Constructor Summary

      Constructors 
      Constructor Description
      LocaleUtils()  
    • Method Summary

      Modifier and Type Method Description
      static java.util.Locale parse​(java.lang.String localeStr)
      Parse the given locale as language, language-country or language-country-variant.
      static java.util.Locale parse5x​(java.lang.String localeStr)
      Deprecated.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocaleUtils

        public LocaleUtils()
    • Method Detail

      • parse

        public static java.util.Locale parse​(java.lang.String localeStr)
        Parse the given locale as language, language-country or language-country-variant. Either underscores or hyphens may be used as separators, but consistently, ie. you may not use an hyphen to separate the language from the country and an underscore to separate the country from the variant.
        Throws:
        java.lang.IllegalArgumentException - if there are too many parts in the locale string
        java.lang.IllegalArgumentException - if the language or country is not recognized
      • parse5x

        @Deprecated
        public static java.util.Locale parse5x​(java.lang.String localeStr)
        Deprecated.
        Parse the string describing a locale into a Locale object for 5.x indices.