Returns the primary message codewords for mode 3.

@param postcode the postal code
@param country the country code
@param service the service code
@return the primary message, as codewords
167519
private static int[] getMode3PrimaryCodewords(String postcode, int country, int service) {

        int[] postcodeNums = new int[postcode.length()];

        postcode = postcode.toUpperCase();
        for (int i = 0; i < postcodeNums.length; i++) {
            postcodeNums[i] = postcode.charAt(i);
            if (postcode.charAt(i) >= 'A' && postcode.charAt(i) <= 'Z') {
                // (Capital) letters shifted to Code Set A values
                postcodeNums[i] -= 64;
            }
            if (postcodeNums[i] == 27 || postcodeNums[i] == 31 || postcodeNums[i] == 33 || postcodeNums[i] >= 59) {
                // Not a valid postal code character, use space instead
                postcodeNums[i] = 32;
            }
            // Input characters lower than 27 (NUL - SUB) in postal code are interpreted as capital
            // letters in Code Set A (e.g. LF becomes 'J')
        }

        int[] primary = new int[10];
        primary[0] = ((postcodeNums[5] & 0x03) << 4) | 3;
        primary[1] = ((postcodeNums[4] & 0x03) << 4) | ((postcodeNums[5] & 0x3c) >> 2);
        primary[2] = ((postcodeNums[3] & 0x03) << 4) | ((postcodeNums[4] & 0x3c) >> 2);
        primary[3] = ((postcodeNums[2] & 0x03) << 4) | ((postcodeNums[3] & 0x3c) >> 2);
        primary[4] = ((postcodeNums[1] & 0x03) << 4) | ((postcodeNums[2] & 0x3c) >> 2);
        primary[5] = ((postcodeNums[0] & 0x03) << 4) | ((postcodeNums[1] & 0x3c) >> 2);
        primary[6] = ((postcodeNums[0] & 0x3c) >> 2) | ((country & 0x3) << 4);
        primary[7] = (country & 0xfc) >> 2;
        primary[8] = ((country & 0x300) >> 8) | ((service & 0xf) << 2);
        primary[9] = ((service & 0x3f0) >> 4);

        return primary;
    }
57513
public static String buildKey(final RegisteredService service) {
        return service.getId() + ";" + service.getName() + ';' + service.getServiceId();
    }
446701
public static String getText(String code, Object[] args, Locale locale) {
        Preconditions.checkState(messageSource != null,
                "If i18n is enabled, please make sure MessageSource is properly set as a member in "
                        + "MessageSupport");
        return messageSource.getMessage(code, args, locale);
    }
1182482
private int[] getPrimaryCodewords() {

        assert mode == 2 || mode == 3;

        if (primaryData.length() != 15) {
            throw new OkapiException("Invalid Primary String");
        }

        for (int i = 9; i < 15; i++) { /* check that country code and service are numeric */
            if (primaryData.charAt(i) < '0' || primaryData.charAt(i) > '9') {
                throw new OkapiException("Invalid Primary String");
            }
        }

        String postcode;
        if (mode == 2) {
            postcode = primaryData.substring(0, 9);
            int index = postcode.indexOf(' ');
            if (index != -1) {
                postcode = postcode.substring(0, index);
            }
        } else {
            // if (mode == 3)
            postcode = primaryData.substring(0, 6);
        }

        int country = Integer.parseInt(primaryData.substring(9, 12));
        int service = Integer.parseInt(primaryData.substring(12, 15));

        if (debug) {
            System.out.println("Using mode " + mode);
            System.out.println("     Postcode: " + postcode);
            System.out.println("     Country Code: " + country);
            System.out.println("     Service: " + service);
        }

        if (mode == 2) {
            return getMode2PrimaryCodewords(postcode, country, service);
        } else { // mode == 3
            return getMode3PrimaryCodewords(postcode, country, service);
        }
    }
265905
public GeoServiceGeocodingResult toGeoServiceGeocodingResult(
            final GeocodingResult result) {
        if (result == null) {
            return null;
        }
        return new GeoServiceGeocodingResult(
                result.addressComponents,
                result.formattedAddress,
                result.postcodeLocalities,
                toGeoServiceGeometry(result.geometry),
                result.types,
                result.partialMatch,
                result.placeId);
    }
35131
@Nullable
  public static String getDialCodeOfCountry (@Nullable final String sCountry)
  {
    if (StringHelper.hasNoText (sCountry))
      return null;
    return s_aCountryToDialCode.get (sCountry.toUpperCase (Locale.US));
  }
499134
public String getMessage(final String code) {
    checkNotNull(code);

    for (ResourceBundle bundle : bundles) {
      try {
        return bundle.getString(code);
      }
      catch (MissingResourceException e) {
        log.trace(e.toString(), e);
      }
    }

    throw new ResourceNotFoundException(code);
  }
805831
public PostalAddress changePostalAddress(
            final String addressLine1,
            final @Parameter(optionality = Optionality.OPTIONAL) String addressLine2,
            final @Parameter(optionality = Optionality.OPTIONAL) String addressLine3,
            final String city,
            final String postalCode) {
        setAddress1(addressLine1);
        setAddress2(addressLine2);
        setAddress3(addressLine3);
        setCity(city);
        setPostalCode(postalCode);

        return this;
    }
1124696
public static String getKafTagSet(final String postag, final String lang) {
    
    String tag = null;
    if (lang.equalsIgnoreCase("de")) {
      tag = mapGermanTagSetToKaf(postag);
    } else if (lang.equalsIgnoreCase("en")) {
      tag = mapEnglishTagSetToKaf(postag);
    } else if (lang.equalsIgnoreCase("es")) {
      tag = mapSpanishTagSetToKaf(postag);
    } else if (lang.equalsIgnoreCase("eu")) {
      tag = mapUDTagSetToKaf(postag);
    } else if (lang.equalsIgnoreCase("gl")) {
      tag = mapGalicianTagSetToKaf(postag);
    } else if (lang.equalsIgnoreCase("fr")) {
      tag = mapFrenchTagSetToKaf(postag);
    } else if (lang.equalsIgnoreCase("it")) {
      tag = mapUDTagSetToKaf(postag);
    } else if (lang.equalsIgnoreCase("nl")) {
      tag = mapWotanTagSetToKaf(postag);
    } else {
      tag = "O";
    }
    return tag;
  }
550460
@Override
    public CountryContract getCountryFromCode(String countryCode) {
        if(StringUtils.isBlank(countryCode)) return null;
        CountryContract country = getKcCountryService().getCountryByAlternateCode(countryCode);
        if(country==null){
            country = getKcCountryService().getCountry(countryCode);
        }
        return country;
    }
872862
def geocode(self, string, bounds=None, region=None,
                language=None, sensor=False):
        '''
        '''
        if isinstance(string, unicode):
            string = string.encode('utf-8')

        params = {
            'address': self.format_string % string,
            'sensor': str(sensor).lower()
        }

        
        if bounds:
            params['bounds'] = bounds
            
        if region:
            params['region'] = region
            
        if language:
            params['language'] = language
            

        if not self.premier:
            url = self.get_url(params)
        else:
            url = self.get_signed_url(params)

        return self.GetService_url(url)
606537
public function determinePostalType($postalcode)
    {
        $postalcode = str_replace(' ', '', $postalcode);

        if (strlen($postalcode) == 6) {
            return ['nl_sixpp' => $postalcode];
        }

        if (strlen($postalcode) == 4) {
            return ['nl_fourpp' => $postalcode];
        }

        throw new \Exception('No valid postalcode was found (nl_sixpp or nl_fourpp)');
    }
834719
@Transient
    public String[] getPostcodeLocalities() {
        final Feature location = getLocation();
        if (location == null) {
            return null;
        }
        return location.getProperty("postcodeLocalities");
    }
494400
function countryCodeToName (code) {
  const country = countries.find((country) => country.code === code)

  if (!country) {
    return code
  }

  return country.name
}
1081618
private String getLocalizationMessages(CmsMessages messages) {

        JSONObject result = new JSONObject();
        try {
            result.put("search", messages.key(Messages.GUI_CODEMIRROR_LANG_SEARCH_0));
            result.put("hint", messages.key(Messages.GUI_CODEMIRROR_LANG_HINT_0));
            result.put("replace", messages.key(Messages.GUI_CODEMIRROR_LANG_REPLACE_0));
            result.put("replacewith", messages.key(Messages.GUI_CODEMIRROR_LANG_REPLACE_WITH_0));
            result.put("replaceconfirm", messages.key(Messages.GUI_CODEMIRROR_LANG_REPLACE_CONFIRM_0));
            result.put("replaceyes", messages.key(Messages.GUI_CODEMIRROR_LANG_REPLACE_YES_0));
            result.put("replaceno", messages.key(Messages.GUI_CODEMIRROR_LANG_RELACE_NO_0));
            result.put("replacestop", messages.key(Messages.GUI_CODEMIRROR_LANG_REPLACE_STOP_0));

            result.put("fontsize", messages.key(Messages.GUI_CODEMIRROR_LANG_FONT_SIZE_0));
        } catch (org.opencms.json.JSONException e) {
            // should never happen
        }
        return result.toString();
    }
64994
@Nullable
  public static String getAsStringW3C (@Nullable final ZonedDateTime aDateTime)
  {
    if (aDateTime == null)
      return null;
    final DateTimeFormatter aFormatter = PDTFormatter.getForPattern (FORMAT_W3C, LOCALE_TO_USE);
    return aFormatter.format (aDateTime);
  }
141959
public Map<String, String> toMap() {
        Map<String, String> map = new HashMap<>();

        map.put("message", message);
        map.put("country-code", countryCode);
        map.put("url", url);

        return map;
    }