Giter Site home page Giter Site logo

pooooriya / go-persian-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from persian-tools/go-persian-tools

1.0 0.0 0.0 68 KB

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

Shell 0.18% Go 99.11% Makefile 0.37% Dockerfile 0.34%

go-persian-tools's Introduction

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

go-persian-tools's People

Contributors

lapulgaynwa avatar masihtehrani avatar nimahkh avatar pooooriya avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.