Skip to main content

evaluate_all_countries

Function evaluate_all_countries 

Source
pub fn evaluate_all_countries(
    haystack: &str,
    check_position: bool,
) -> Result<Option<PostcodeWrapper>, PostcodeError>
Expand description

Will attempt to parse a postcode from an address or a single postcode, and determine which country it comes from.

Use check_position to control whether you are evaluating a whole address or a single postcode. For example

  • check_position = true: “15 Main Road, EN35 0RS” will find “EN35 0RS” and identify the country as United Kingdom
  • check_position = false: “EN35 0RS” will find “EN35 0RS” and identify the country as United Kingdom

Note that some countries can not be uniquely identified, for example, if they use a five digit postcode