persian_tools library
persian_tools is main lib
Classes
Enums
- DigitLocale
- Determines language of the digits in wordsToNumber and wordsToNumberString functions.
Extensions
- AddOrdinalSuffix on String
- String Extension wrapper to adding ordinal suffix to String object
- BankNameFromCardNumber on String
- String Extension wrapper to getting bank name from String object
- CommasNum on num
- num Extension wrapper to adding comma to the String object
- CommasString on String
- String Extension wrapper to removing and adding comma to the String object
- NationalId on String
- String Extension wrapper to checking iranian national id verification
- NumberToPersianWordsInt on int
- int Extension wrapper to convert number to Persian word on int object
- NumberToPersianWordsString on String
- String Extension wrapper to convert number to Persian word on String object
- PhoneNumberExtension on String
- String Extension wrapper to use getPhonePrefix, getPhoneNumberDetail and phoneNumberValidator on String object
- PlaceByNationalId on String
- String Extension wrapper to getting place information from String object as national id
- RemoveOrdinalSuffix on String
- String Extension wrapper to remove ordinal suffix on String object
- VehiclePlate on String
- String Extension wrapper to creating plate based on the String object
- WordsToNumber on String
- String Extension wrapper to convert String object to its equivalent number in int and String.
Properties
-
billTypesMap
→ Map<
int, String> -
Saves bill types as a
Map<int, String>
final
Functions
-
addCommas(
Object number) → String - Takes an integer or string and add commas as separator NOTE: it converts Fa digits to En digits
-
addOrdinalSuffix(
String number) → String - Adds ordinal suffixes to numbers
-
carHandler(
NormalizedPlate plate) → PlateInfo - Gives car's plate information from its normalized form of the plate
-
convertArToEn(
String digits) → String - Takes a String that includes Arabic digits and converts them to English digits
-
convertArToFa(
String digits) → String - Takes a String that includes Arabic digits and converts them to Persian digits
-
convertEnToAr(
String digits) → String - Takes a String that includes English digits and coverts them to Persian digits
-
convertEnToFa(
String digits) → String - Takes a String that includes English digits and coverts them to Persian digits
-
convertFaToEn(
String digits) → String - Takes a String that includes Persian digits and converts them to English digits
-
getBankNameFromCardNumber(
String cardNumber) → Bank? -
Checks the
cardNumber
is a valid bank card and returns theBank
info if it isn't a valid card or not related to a bank it will returns null -
getPhoneNumberDetail(
String phoneNumber) → OperatorDetail? - Finds information such as province, type and model of phone number.
-
getPhonePrefix(
String phoneNumber) → String - Returns the phone number prefix
-
getPlaceByIranNationalId(
String nationalId) → NationalIdPlace? - Gives the place information based on the given String as national id
-
getPlateHandler(
NormalizedPlate plate) → PlateHandler - Gives plate handler based on normalized form of the plate
-
getPlateInfo(
NormalizedPlate plate) → PlateInfo - Gives plate information from its normalized form in normalizePlate
-
hasPersian(
String input, [bool isComplex = false]) → bool - Check is the input string includes Persian alphabet or not returns true if the input is matched with Farsi char dataset RegExp, if not returns false
-
isPersian(
String input, [bool isComplex = false, Pattern? trimPattern]) → bool - Check is the input string Persian or not returns true if the input is matched with Farsi char dataset RegExp, if not returns false
-
isPlateNumberValid(
String number) → bool - Checks plate number validation
-
isPlateValid(
PlateInfo plateInfo, NormalizedPlate normalizedPlate) → bool - Checks plate validation
-
motorcycleHandler(
NormalizedPlate plate) → PlateInfo - Gives motorcycle's plate information from its normalized form of the plate
-
normalizePlate(
String plate) → NormalizedPlate - Normalizes the Plate (or separate char part from number part)
-
numberToWords(
int number, {bool ordinal = false}) → String -
Returns Persian word of the given number in int You can determine
returned string has ordinal suffix or not by
ordinal
flag. -
numberToWordsString(
String number, {bool ordinal = false}) → String? -
Returns Persian word of the given number in String. Number can contain commas.
You can determine returned string has ordinal suffix or not by
ordinal
flag. -
phoneNumberValidator(
String phoneNumber) → bool - validate phone number and returns true if the given String phone number matched with pattern otherwise returns false.
-
removeCommas(
String number) → num - Takes a string and it should be includes integer then remove all the commas
-
removeOrdinalSuffix(
String word) → String - Removes ordinal suffixes to numbers
-
urlFix(
String url) → String - Takes an URL in http/s , ws/s as String and fix the Persian characters in it
-
validateCardNumber(
String cardNumber) → bool - Checks validation of the given ATM card number
-
verifyIranianNationalId(
String value) → bool - Checks the given String is an iranian national ID or not
-
wordsToNumber(
String words) → int? - Returns equivalent number in int of the given words
-
wordsToNumberString(
String words, {DigitLocale digits = DigitLocale.en, bool addComma = false}) → String? - Returns equivalent number in String of the given words.
Typedefs
- PlateHandler = PlateInfo Function(NormalizedPlate)
- Plate handler functions typedef