@Override public void parse(String field, Data data) { if (field.endsWith("-")) field = field.substring(0, field.length() - 1); if (field.length() == 0) return; String city = CITY_CODES.getProperty(field); if (city != null) { data.strCity = city; } else { super.parse(field, data); } }
/** * Set state field if required * * @param data parsed data object */ static void adjustCityState(Data data) { // Expand abbreviated city codes String upCity = data.strCity.toUpperCase(); String city = CITY_CODES.getProperty(upCity); if (city != null) { data.strCity = city; upCity = city.toUpperCase(); } // Some city names are subdivisons or apartment complexes city = PLACE_NAMES.getProperty(upCity); if (city != null) { data.strPlace = append(data.strPlace, " - ", data.strCity); data.strCity = city; } String state = CITY_STATE_TABLE.getProperty(data.strCity.toUpperCase()); if (state != null) data.strState = state; }