[−][src]Trait iban::IbanLike
A trait that provide basic functions on an IBAN. It is implemented by both Iban
,
which represents a fully validated IBAN, and BaseIban
, which might not have a correct BBAN.
Required methods
fn electronic_str(&self) -> &str
Get the IBAN in the electronic format, without whitespace. This method is simply a view into the inner string.
Example
use iban::*; let iban: Iban = "DE44 5001 0517 5407 3249 31".parse()?; assert_eq!(iban.electronic_str(), "DE44500105175407324931");
Provided methods
fn country_code(&self) -> &str
Get the country code of the IBAN. This method simply returns a slice of the inner representation.
Example
use iban::*; let iban: Iban = "DE44 5001 0517 5407 3249 31".parse()?; assert_eq!(iban.country_code(), "DE");
fn check_digits_str(&self) -> &str
Get the check digits of the IBAN, as a string slice. This method simply returns
a slice of the inner representation. To obtain an integer instead,
use check_digits
.
Example
use iban::*; let iban: Iban = "DE44 5001 0517 5407 3249 31".parse()?; assert_eq!(iban.check_digits_str(), "44");
fn check_digits(&self) -> u8
Get the check digits of the IBAN. This method parses the digits to an
integer, performing slightly more work than check_digits_str
.
Example
use iban::*; let iban: Iban = "DE44 5001 0517 5407 3249 31".parse()?; assert_eq!(iban.check_digits(), 44);
fn bban_unchecked(&self) -> &str
Get the BBAN part of the IBAN, as a &str
. Note that the BBAN is not
necessarily valid if this is not guaranteed by the implementing type.
Use Iban::bban
to guarantee a correct BBAN.
Example
use iban::*; let iban: Iban = "DE44 5001 0517 5407 3249 31".parse()?; assert_eq!(iban.bban_unchecked(), "500105175407324931");