PersianTools class

Constructors

PersianTools.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

convertDigits(String digits, DigitLocale from, DigitLocale to) String
Converts digits between different locales @param digits The digits to convert @param from Source locale @param to Target locale @returns String Converted digits Example: PersianTools.convertDigits("123", DigitLocale.en, DigitLocale.fa) => "۱۲۳"
formatCardNumber(String cardNumber) String?
Formats bank card number @param cardNumber The card number to format @returns String? Formatted card number or null if invalid Example: PersianTools.formatCardNumber("6219861034567890") => "6219-8610-3456-7890"
formatPhoneNumber(String phoneNumber) String?
Formats phone number @param phoneNumber The phone number to format @returns String? Formatted phone number or null if invalid Example: PersianTools.formatPhoneNumber("09123456789") => "+98912-345-6789"
getBankFromSheba(String sheba) BankInfo?
Gets bank information from IBAN @param sheba The IBAN number @returns BankInfo? Bank information or null if invalid Example: PersianTools.getBankFromSheba("IR123456789012345678901234") => BankInfo(...)
getBankNameFromCard(String cardNumber) String?
Gets bank name from card number @param cardNumber The card number @returns String? Bank name or null if not found Example: PersianTools.getBankNameFromCard("6219861034567890") => "بانک سامان"
getPhoneDetails(String phoneNumber) OperatorDetail?
Validates phone number and returns operator details @param phoneNumber The phone number to validate @returns OperatorDetail? Operator details or null if invalid Example: PersianTools.getPhoneDetails("09123456789") => OperatorDetail(...)
hasPersian(String input, {bool complex = false}) bool
Checks if the input string contains any Persian characters @param input The string to check @param complex Whether to use complex Persian character set @returns bool True if input contains Persian characters Example: PersianTools.hasPersian("Hello سلام") => true
isPersian(String input, {bool complex = false}) bool
Validates if the input string contains only Persian characters @param input The string to validate @param complex Whether to use complex Persian character set @returns bool True if input is valid Persian text Example: PersianTools.isPersian("سلام") => true
isShebaValid(String sheba) bool
Validates Iranian IBAN (Sheba) number @param sheba The IBAN number @returns bool True if valid Example: PersianTools.isShebaValid("IR123456789012345678901234") => true
numberToWords(num number, {bool ordinal = false}) String?
Converts number to Persian words @param number The number to convert @param ordinal Whether to use ordinal form @returns String? Converted number or null if invalid Example: PersianTools.numberToWords(123) => "یکصد و بیست و سه"
replaceMapValue(String input, Map<String, String> mapPattern) String
Replaces patterns in string using a map @param input The input string @param mapPattern Map of patterns to replacements @returns String String with replaced patterns Example: PersianTools.replaceMapValue("شیش صد", {"شیش صد": "ششصد"}) => "ششصد"
trim(String input) String
Trims whitespace from start and end of string @param input The string to trim @returns String Trimmed string Example: PersianTools.trim(" hello ") => "hello"
validateCardNumber(String cardNumber) bool
Validates Iranian bank card number @param cardNumber The card number to validate @returns bool True if valid Example: PersianTools.validateCardNumber("6219861034567890") => true
verifyNationalId(String id) bool
Validates Iranian national ID @param id The national ID to validate @returns bool True if valid Example: PersianTools.verifyNationalId("1234567890") => false
wordsToNumberString(String words, {DigitLocale digits = DigitLocale.en, bool addComma = false}) String?
Converts Persian number words to number @param words The words to convert @param digits Output digit format @param addComma Whether to add commas to output @returns String? Converted number or null if invalid Example: PersianTools.wordsToNumberString("یکصد و بیست و سه") => "123"