code: private static int parseTagString(String localeID, String tags[]) {
          LocaleIDParser parser = new LocaleIDParser(localeID);
  
          String lang = parser.getLanguage();
          String script = parser.getScript();
          String region = parser.getCountry();
  
          if (isEmptyString(lang)) {
              tags[0] = UNDEFINED_LANGUAGE;
          }
          else {
              tags[0] = lang;
          }
  
          if (script.equals(UNDEFINED_SCRIPT)) {
              tags[1] = "";
          }
          else {
              tags[1] = script;
          }
  
          if (region.equals(UNDEFINED_REGION)) {
              tags[2] = "";
          }
          else {
              tags[2] = region;
          }
  
          /*
           * Search for the variant.  If there is one, then return the index of
           * the preceeding separator.
           * If there's no variant, search for the keyword delimiter,
           * and return its index.  Otherwise, return the length of the
           * string.
           *
           * $TOTO(dbertoni) we need to take into account that we might
           * find a part of the language as the variant, since it can
           * can have a variant portion that is long enough to contain
           * the same characters as the variant.
           */
          String variant = parser.getVariant();
  
          if (!isEmptyString(variant)){
              int index = localeID.indexOf(variant);
  
  
              return  index > 0 ? index - 1 : index;
          }
          else
          {
              int index = localeID.indexOf('@');
  
              return index == -1 ? localeID.length() : index;
          }
      }
docs: Parse the language, script, and region subtags from a tag string, and return the results.
  
  This function does not return the canonical strings for the unknown script and region.
  
  @param localeID The locale ID to parse.
  @param tags An array of three String references to return the subtag strings.
  @return The number of chars of the localeID parameter consumed.