In this page
GreyCat Finance Library
@library("finance", "0.0.0");
Financial utilities for GreyCat. Provides IBAN (International Bank Account Number) parsing and validation according to the ISO 13616 standard.
Quick Start
var iban = Iban::parse("FR76 3000 6000 0112 3456 7890 189");
if (iban != null) {
info("Country: ${iban.country}"); // "FR"
info("Bank: ${iban.bank}"); // bank identifier
info("Account: ${iban.account}"); // account number
info("Full IBAN: ${iban.iban}"); // normalized IBAN string
} else {
info("Invalid IBAN");
}
API Reference
Iban
Represents a parsed and validated International Bank Account Number.
Static Methods:
| Method | Returns | Description |
|---|---|---|
Iban::parse(iban) |
Iban? |
Parse and validate an IBAN string. Returns null if invalid. Spaces are automatically removed. |
Fields:
| Field | Type | Description |
|---|---|---|
iban |
String |
Complete IBAN in standard format |
country |
String |
Two-letter ISO 3166-1 country code (e.g., "FR", "DE", "GB") |
bank |
String |
Bank identifier extracted from the BBAN portion |
account |
String |
Account number extracted from the BBAN portion |
Validation
Iban::parse performs full validation:
- Format and length checks per country
- Mod-97 check digit verification (ISO 7064)
- Country-specific BBAN structure validation
Invalid or malformed strings return null.
// Valid IBAN
var valid = Iban::parse("DE89370400440532013000");
Assert::isNotNull(valid);
// Invalid check digits → null
var invalid = Iban::parse("DE00370400440532013000");
Assert::isNull(invalid);