Skip to content

An anthology of a variety of tools for the Persian language in Golang

Notifications You must be signed in to change notification settings

persian-tools/go-persian-tools

Repository files navigation

Persian tools

An anthology of a variety of tools for the Persian language in Golang

CircleCI codecov


Todos

  • Bill calculator
  • Digits
  • Validate Bank card number.
  • Find Bank's name by Card number.
  • Check Iranian Sheba(IBAN) validation and recognize bank information by sheba code.
  • Add and remove commas to numbers.
  • Find city and province name by national code(code-e Melli).
  • Validate Iranian national number(code-e Melli).

How to use it?

first we have to create our request :

bills "github.com/nimahkh/persian_tools/bills"
.
.
.
currencyParam := bills.Currency{false, false}
params := bills.BillParams{1117753200140, 12070160, currency_param, "1"}

And pass it

Bills
result := bills.GetBillType(params) // تلفن ثابت 
amount := bills.GetCurrency(params) //120000
barcode := bills.GetBarCode(params) //  111775320014000012070160
verify := bills.VerifyBillID(params) //true
Digits
num2wordFa := digits.DigitToWord("۱۵۶۷۸۹") // صد پنجاه و شش هزار هفتصد هشتاد و نه 
num2wordEn := digits.DigitToWord("156789") // صد پنجاه و شش هزار هفتصد هشتاد و نه 
Negative := digits.DigitToWord("-156789") // منفی صد پنجاه و شش هزار هفتصد هشتاد و نه 

Bank

CardInfo Method

Method has one entry card number and return bank name and error.

bank,error := CardInfo("") // "", error
bank,error := CardInfo("345345") // "", error
bank,error := CardInfo("6219861034529008") // "", error
bank,error := CardInfo("6037701689095443") // keshavarzi, nil
bank,error := CardInfo("6219861034529007") // saman, nil
Check Iranian Sheba

The types of results are :

type shebaResultHash struct {
	Name                   string
	Code                   string
	NickName               string
	PersianName            string
	AccountNumber          string
	AccountNumberAvailable bool
	FormattedAccountNumber string
	Process                func(str string) ShebaProcess
}
shebaCode := bank.ShebaCode{"IR820540102680020817909002"}
sheba := shebaCode.IsSheba() // {Parsian Bank 054 parsian بانک پارسیان  true  0x4c69f0}
shebaCode.Code= "IR820540102680020817909003"
sheba := shebaCode.IsSheba() // {  false }
Add Remove Commas to number
addComma := digits.AddCommas(14555478854)
removeComma := digits.RemoveCommas("4,555,522,212,12")

fmt.Printf("\n ADD COMMA : %v \n", addComma) // 14,555,478,854 
fmt.Printf("\n REMOVE COMMA : %v \n", removeComma)// 455552221212 
Get Place and city By NationalID
getPlaceByIranNationalId := city.GetPlaceByIranNationalId("0499370899")
fmt.Printf("\n Result : %v \n", getPlaceByIranNationalId)
Validate Iranian national number(code-e Melli)
verifyIranianNationalId := national_id.Validate("0067749828")
verifyIranianNationalIdFalse := national_id.Validate("0684159415")

fmt.Printf("\n Validate NationalID : %v \n", verifyIranianNationalId) // true
fmt.Printf("\n Validate NationalIDFalse : %v \n", verifyIranianNationalIdFalse) // false

About

An anthology of a variety of tools for the Persian language in Golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages