normalizeLocale static method

String normalizeLocale(
  1. Locale locale
)

Return the string representation of the locale, normalized (trims spaces and underscore).

Implementation

static String normalizeLocale(Locale locale) {
  String str = locale.toString().toLowerCase();
  RegExp pattern = RegExp('^[_ ]+|[_ ]+\$');
  return str.replaceAll(pattern, '');
}