Module swift_utils

Module swift_utils 

Source
Expand description

§Core SWIFT Utility Functions

Low-level parsing utilities for SWIFT MT message primitive data types. These utilities handle basic SWIFT data formats like BIC codes, currency codes, dates, amounts, and character validation.

Functions§

format_swift_amount
Format amount for SWIFT output with comma decimal separator
format_swift_amount_for_currency
Format amount for SWIFT output with currency-specific decimal precision
get_currency_decimals
Get the number of decimal places for a currency according to ISO 4217
normalize_text
Clean and normalize text (remove extra whitespace, normalize line endings)
parse_account
Parse account number (max 34 characters)
parse_alphanumeric
Parse alphanumeric string (letters and digits only)
parse_amount
Parse amount with optional decimal places
parse_amount_with_currency
Parse amount with currency-specific decimal validation
parse_bic
Parse BIC code (8 or 11 characters)
parse_currency
Parse currency code (3 uppercase letters)
parse_currency_non_commodity
Parse currency code with commodity validation (enforces C08 rule)
parse_date_yymmdd
Parse date in YYMMDD format
parse_date_yyyymmdd
Parse date in YYYYMMDD format
parse_datetime_yymmddhhmm
Parse datetime in YYMMDDHHMM format
parse_exact_length
Parse a string with exact length requirement
parse_length_range
Parse a string with minimum and maximum length
parse_max_length
Parse a string with maximum length limit
parse_numeric
Parse numeric string (digits only)
parse_reference
Parse reference (16x - alphanumeric, max 16 chars)
parse_swift_chars
Parse SWIFT character set (a-z, A-Z, 0-9, and special chars)
parse_swift_digits
Parse SWIFT digits format (digits only, used for numeric fields)
parse_time_hhmm
Parse time in HHMM format
parse_uppercase
Parse uppercase letters only
split_at_first
Split input at first occurrence of delimiter
split_at_newline
Split input at first newline
validate_amount_decimals
Validate amount decimal precision for a specific currency (C03 validation)
validate_iban
Validate IBAN format
validate_non_commodity_currency
Validate that currency is not a commodity code (C08 validation)