How to get Locale from its String representation in Java?

前端 未结 12 1040
慢半拍i
慢半拍i 2020-12-08 00:06

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 b

12条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 00:22

    Method that returns locale from string exists in commons-lang library: LocaleUtils.toLocale(localeAsString)

提交回复
热议问题