Skip to main content

validate_bic

Function validate_bic 

Source
pub fn validate_bic(input: &str) -> ValidationOutcome
Expand description

Validates a BIC (ISO 9362) by length + alphanumeric layout.

Valid BICs are 8 or 11 characters, all ASCII letters and digits. The first 4 are the bank code (letters), next 2 the country code (letters), next 2 the location code (alphanumeric); positions 9–11 (when present) are the branch code.

§Examples

use ssg::seo::jsonld::iso20022::validate_bic;
assert!(validate_bic("NWBKGB2L").is_valid());
assert!(validate_bic("NWBKGB2LXXX").is_valid());
assert!(!validate_bic("NWBKGB").is_valid());