UPersianTools class
Iranian helpers: national code, card/Sheba checks and bank names, number ⇄ Persian words, mobile operator lookup. UPersianTools.validateNationalCode("0012345678")
Constructors
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, UDigitLocale from, UDigitLocale to) → String -
Converts digits between English, Persian and Arabic.
UPersianTools.convertDigits("123", UDigitLocale.en, UDigitLocale.fa) -
formatCardNumber(
String cardNumber) → String? - "6037-9912-3456-7890", or null when invalid.
-
formatPhoneNumber(
String phoneNumber) → String? - "+98912-123-4567" style, or null when not a mobile number.
-
getBankFromSheba(
String sheba) → UBankInfo? - Bank (and account number when possible) from a Sheba.
-
getBankNameFromCard(
String cardNumber) → String? -
Bank name from a card's first 6 digits.
UPersianTools.getBankNameFromCard(card)→ "بانک ملی" -
getPhoneDetails(
String phoneNumber) → UOperatorDetail? -
Operator, SIM type and province of an Iranian mobile number.
UPersianTools.getPhoneDetails("09121234567")?.name -
hasPersian(
String input, {bool complex = false}) → bool -
True when
inputcontains any Persian letter. -
isPersian(
String input, {bool complex = false}) → bool -
True when
inputis Persian text only (spaces/punctuation allowed).UPersianTools.isPersian("سلام") -
isShebaValid(
String sheba) → bool -
Checks an IBAN/Sheba "IR" + 24 digits (mod 97).
UPersianTools.isShebaValid("IR062960000000100324200001") -
numberToWords(
num number, {bool ordinal = false}) → String? -
Number in Persian words;
ordinalgives "یکم، دوم…".UPersianTools.numberToWords(1250)→ "یک هزار و دویست و پنجاه" -
replaceMapValue(
String input, Map< String, String> mapPattern) → String -
Replaces every key of
mapPatternfound ininputwith its value. -
trim(
String input) → String - Trims spaces.
-
validateCardNumber(
String cardNumber) → bool -
Checks a 16-digit bank card number (Luhn).
UPersianTools.validateCardNumber("6037991234567890") -
validateNationalCode(
String? input) → bool -
Checks an Iranian national code (کد ملی) checksum.
UPersianTools.validateNationalCode(code) -
validateTaxMemoryId(
String? input) → bool - Checks an Iranian tax memory id format.
-
wordsToNumberString(
String words, {UDigitLocale digits = UDigitLocale.en, bool addComma = false}) → String? -
Persian words → number text.
UPersianTools.wordsToNumberString("سیصد و پنج")→ "305"