- Adding ordinal suffixes
- Converting Persian words to number
- Converting Persian numbers to word
- Adding and removing separator to/from numbers
- Converting Persian numbers to Arabic / English numbers and reverse
- Checking a string has/is Persian
- Validating Iranians national id
- Finding city and province names by national id
- Calculating bills
- Checking IBAN of the bank account (SHEBA)
- Validating ATM card number
- Finding name of banks by ATM card number
- Getting information from vehicle plate
- Fixing and decoding URLs with whitespace
now let's look at examples and how work with apis in package
-
Adding Ordinal Suffixes - source
var number = 'سی سه'; // or سی | شصت | پنجاه دو
addOrdinalSuffix(number); // سی سوم | سی اُم | شصتم | پنجاه دوم
number.withOrdinalSuffix // ... like so
-
Converting Persian numbers to Arabic / English numbers and reverse - source
convertArToFa('السلام علیکم 14۱۲۳6٤٥'); // السلام علیکم 14۱۲۳6۴۵
convertArToEn('Persian Tools : 123٥٦٧'); // Persian Tools : 123567
convertEnToFa('سلام این هارو فارسی کن : 22۲۳۴'); // سلام این هارو فارسی کن : ۲۲۲۳۴
convertFaToEn('سلام این هارو اینگلیسی کن : 22۲۳۴'); // سلام این هارو اینگلیسی کن : 22234
-
Checking a string has/is Persian - source
isPersian('این یک متن فارسی است؟'); // true
isPersian('هل هذا نص فارسي؟'); // false
hasPersian('This text includes فارسی'); // true
hasPersian('Это персидский س текст?'); // true
hasPersian('أكد رئيس اللجنة العسكرية الممثلة لحكومة الوفاق أراضي البلاد.'); //true
-
Validate Iranian national ID - source
var nationalID = '0684159414';
verifyIranianNationalId(nationalID); // true
///the nationalID should contain 10 digit, so the following verifications
///should return false
nationalID = '00000';
verifyIranianNationalId(nationalID); // false
/// verify nationalId with extension methods over [String] class
nationalID = '';
nationalID.isIranianNationalId; // false
-
Find city and province name by national code - source
final place = getPlaceByIranNationalId('0084575948');
place?.city.name; // تهران مرکزی
place?.province.name; // تهران
/// get place with extension methods over [String] class
final nationalId = '2110990147';
nationalId.getPlaceNationalId?.city.name; // گرگان
nationalId.getPlaceNationalId?.province.name; // گلستان
-
Calculating Bill - source
var bill = Bill(billId: 9174639504124, paymentId: 12908197, currency: 'rial');
bill.barcode // 917463950412400012908197
bill.billType // برق
bill.amount // 129000
bill.isBillValid // false
bill.isPaymentIdValid // false
bill.isBillIdValid // true
// returns all the above getter as a Map with same as getters
bill();
-
Checking IBAN of the bank account (SHEBA) - source
var sheba = Sheba('IR820540102680020817909002');
var bank = sheba(); // Returns nullable object of BankInformation
bank?.nickname // nickname of bank
bank?.name // complete name of bank
bank?.persianName // complete persian name of bank
bank?.code // code of bank
// true means with sheba package can take account number, false means package can't
bank?.isAccountNumberAvailable
bank?.accountNumber // account number in simple numbers
bank?.formattedAccountNumber // account number with hyphen
bank?.process
sheba.isValid // true
-
Validating ATM card number - source
validateCardNumber('6219861034529007'); // true
validateCardNumber('6219861034529007'); // true
validateCardNumber('0000000000000000'); // false
validateCardNumber('621986103452900'); // false
-
Fixing and decoding URLs - source
var url = 'wss://hostname.domain/?q=i am a wrong query';
urlFix(url); // wss://hostname.domain/?q=i%20am%20a%20wrong%20query