분류, 패키지 및 저장소 검색

패키지 상세v1.0.3

persian_tools

Dart가 지원하는 모든 플랫폼에서 사용할 수 있는 펄시어를 위한 다양한 도구의 앙상블

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
219
좋아요
53
Pub 점수
150

패키지 설치

flutter pub add persian_tools

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

페르시안 툴즈는 안드로이드, 아이오스, 웹, 맥OS, 윈도우, 리눅스를 포함한 Dart가 지원하는 모든 플랫폼에서 페르시아어 처리를 위한 유용한 도구 모음을 제공하는 포괄적인 Dart 패키지입니다. 페르시아어 날짜 변환, 숫자 서식 지정, 텍스트 정규화 및 문자 조작과 같은 기능을 제공하여 개발자가 애플리케이션 내에서 페르시아어 텍스트를 효율적으로 다룰 수 있도록 합니다. 간단함과 신뢰성을 고려해 설계되었으며, Flutter 및 비-Flutter Dart 프로젝트에 원활하게 통합됩니다. 이 패키지는 오픈소스이며 페르시안 툴즈 커뮤니티에 의해 적극적으로 유지 관리되고 있습니다.

사용 사례

  • 페르시아 날짜 및 숫자 처리
  • 페르시아어 텍스트 정규화
  • 페르시아 통화 형식 지정
  • 페르시아어 문자열 파싱
  • 페르시아어 앱에서의 국제화
  • 텍스트 검증 및 정리

주요 기능

  • 여러 플랫폼을 지원합니다
  • 날짜 및 숫자 변환기 포함
  • 텍스트 정규화 도구를 제공합니다
  • 오픈소스이며 커뮤니티 주도
  • Flutter와의 간편한 통합
  • 페르시아어 전용 논리 처리를 위한 유틸리티 함수 제공

적합한 대상

  • 페르시아어 사용자를 위한 플러터 앱
  • 페르시아어 콘텐츠를 포함한 데스크톱 및 웹 앱
  • 현지화 및 i18n 프로젝트
  • 페르시아어 텍스트 처리가 필요한 애플리케이션
  • 다국어 도구를 개발하는 개발자

고려 사항

  • 페르시아어 언어 특성에 대한 이해가 필요합니다
  • 기본 사용법 외에 문서가 제한적
  • 페르시아어 텍스트에 집중하는 애플리케이션에 가장 적합
  • 추가적인 로컬라이제이션 설정이 필요할 수 있습니다
  • 대규모 고성능 텍스트 파싱에 최적화되지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Persian tools

Persian Tools dart package which you can use in all platforms

MIT license codecov CI/CD Dart Version pub version status All Contributors


Features

Usage

now let's look at examples and how work with apis in package

  • Adding Ordinal Suffixes - source
var number = 'سی سه'; // or سی | شصت | پنجاه دو
addOrdinalSuffix(number); // سی سوم | سی اُم | شصتم | پنجاه دوم

/// or use it as String extension method
number.withOrdinalSuffix // ... like so
  • Removing Ordinal Suffixes - source
var number = 'چهل و سوم'; // سی سوم | سی اُم | شصتم | پنجاه دوم
removeOrdinalSuffix(number); // سی | شصت | پنجاه دو

/// or use it as String extension method
number.withoutOrdinalSuffix; // ... like so
  • Converting Persian words to number - source
final words = 'سه هزار دویست و دوازده';

/// use [wordsToNumber] method to convert [words] to int number
wordsToNumber(words); // 3212

/// use [wordsToNumberString] method to convert [words] to String
wordsToNumberString(words); // '3212' as String

/// [wordsToNumberString] also has two optional parameter
/// use [digit] optional parameter to convert the digits to specific local digits
/// use [addComma] to add comma between the every 3 digits
wordsToNumberString(
words,
digits: DigitLocale.fa,
addComma: true,
); // '۳,۲۱۲' as String

/// or you can easily use extension methods on String object
words.convertWordsToNumber(); // 3212

words.convertWordsToNumberString(); // '3212' as String
  • Converting Persian numbers to word - source
final stringDigit = '257,433';
final intDigit = -128;

/// use [numberToWordsString] method to convert [stringDigit] to persian

numberToWordsString(stringDigit); // 'دویست و پنجاه و هفت هزار و چهارصد و سی و سه'

/// [numberToWordsString] also has an optional parameter
/// by default [ordinal] is [false], [true] makes the output an ordinal word

numberToWordsString(stringDigit, ordinal: true); // 'دویست و پنجاه و هفت هزار و چهارصد و سی و سوم'

/// use [numberToWordsInt] method to convert [intDigit] to persian
numberToWords(intDigit); // 'منفی صد و بیست و هشت'

/// [numberToWordsInt] also has an optional parameter
/// by default [ordinal] is [false], [true] makes the output an ordinal word
numberToWords(intDigit, ordinal: true); // 'منفی صد و بیست و هشتم'

/// you can simply use extension methods on int or String objects
stringDigit.convertNumToWords(); // 'دویست و پنجاه و هفت هزار و چهارصد و سی و سه'

intDigit.convertNumToWords(); // 'منفی صد و بیست و هشت'
  • Adding and removing separator to / from numbers - source
addCommas('3333'); // 3,333
addCommas('۸۲۳۳۴۵'); // 823,345

removeCommas('654,562'); // 654562
removeCommas('3,365.255'); // 3365.255

'11222'.addComma // 11,222
'4,544.562'.removeComma // 4544.562
  • 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; // گلستان
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
  • Validating Iranians phone number - source
final phoneNumber = '09022002580';

// phone number validator
phoneNumberValidator(phoneNumber); // true

// phone number prefix
getPhonePrefix(phoneNumber); // 902

// phone number detail
final operatorDetail = getPhoneNumberDetail(phoneNumber);
operatorDetail?.name; // ایرانسل
operatorDetail?.provinces; // []
operatorDetail?.base; // کشوری
operatorDetail?.type; // SimCartType.both

/// you can also use this methods as String extension method

// phone number validator
phoneNumber.isPhoneNumber; // true

// phone number prefix
phoneNumber.phoneNumberPrefix; // 902

// phone number detail
phoneNumber.phoneNumberDetail?.name; // ایرانسل
  • Finding banks name by card number - source
final cardNumber = '6037701689095443';

final bankInfo = getBankNameFromCardNumber(cardNumber);
bankInfo?.name; // بانک کشاورزی
bankInfo?.initCode; // 603770

/// you can also use this methods as String extension method

// get bank info from String
cardNumber.bankNameFromCard?.name; // بانک کشاورزی
  • Getting information from vehicle plate - source
var motorcyclePlate = Plate(plate: '12345678');
motorcyclePlate.info.type // Motorcycle
motorcyclePlate.info.template // 123-45678
motorcyclePlate.info.province // مرکز تهران
motorcyclePlate.info.category // null because its type is Motorcycle
motorcyclePlate.isValid // true

// because of persian language you may see plate in wrong form
var carPlate = Plate(plate: '12ب14547');
carPlate.info.type // Car
carPlate.info.template // 12{B}145{Iran}47 , B=ب  Iran=ایران
carPlate.info.province // مرکزی
carPlate.info.category // شخصی
carPlate.isValid // true

// you can also create [Plate] with below String extension method
var motorPlate =  '12345678'.createVehiclePlate;
motorPlate.info.type // Motorcycle
motorPlate.info.template // 123-45678
motorPlate.info.province // مرکز تهران
motorPlate.info.category // null because its type is Motorcycle
motorPlate.isValid // true
  • 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

Contributing

Thank you for your interest in contributing! For more detail about contributing, please check out the CONTRIBUTING.md file.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Ehsan Aramide

💻 📖 💡 🚧 👀 ⚠️

Payam Zahedi

💻 📖 💡 🚧 👀 ⚠️

Mohammad Ali Khosravi

💻 📖 💡 ⚠️ 👀

Ali Torki

🤔 🚧 📆

This project follows the all-contributors specification. Contributions of any kind welcome!

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.