IBAN parsing library.
Add library as a dependency to Cargo.toml.
...
[dependencies]
iban = "1"
...
Construct a Iban
type by using str::parse
, FromStr::from_str
, or Iban::parse
.
use iban::Iban;
let iban: Iban = "AA110011123Z5678"
.parse()
.unwrap_or_else(|err| {
// This example panics, but you should handle the error cases properly.
panic!("invalid iban: {err}");
});
let country_code: &str = iban.country_code();
let bban: iban::Bban = iban.bban();
let bank_identifier: Option<&str> = bban.bank_identifier();
- ISO 13616: https://www.iso13616.org/
- IBAN Registry (pdf): https://www.swift.com/node/9606
- IBAN Registry (txt): https://www.swift.com/node/11971
- php-iban: https://github.com/globalcitizen/php-iban