An anthology of tools for working with Persian (Iranian) data in Go — with no dependencies.
Normalize Persian text, fold Arabic look-alikes, recover text typed on the wrong keyboard layout, and romanize to Finglish.
Convert between Persian, Arabic-Indic and ASCII digits, group and spell numbers, and format Toman and Rial.
Validate card numbers (Luhn), resolve the issuing bank, and validate Sheba (IBAN) codes with bank details.
Validate national numbers (code-e Melli) and resolve the issuing city and province.
Validate Iranian mobile numbers, normalize prefixes and resolve operator details.
Determine a utility bill's type, amount and barcode, and validate its id.
# requires Go 1.22+ — the module has no dependencies
go get github.com/amiranmanesh/go-persian-tools@latest
// text — normalize for comparison import "github.com/amiranmanesh/go-persian-tools/text" text.FixArabic("علي كريم") // علی کریم text.SwitchToPersianKey("sghl") // سلام text.Finglish("سلام") // salam
// digits, money and validators import "github.com/amiranmanesh/go-persian-tools/digit" digit.ToWords(156789) // صد و پنجاه و شش هزار و ... digit.Toman("1234567") // ۱،۲۳۴،۵۶۷ تومان nationalid.Validate("0067749828") // true bank.CardInfo("6037701689095443") // keshavarzi
go install github.com/amiranmanesh/go-persian-tools/cmd/persian-tools@latest persian-tools normalize "علي كريم" # علی کریم persian-tools words 156789 # صد و پنجاه و شش هزار و ... persian-tools currency -unit toman 1234567 # ۱،۲۳۴،۵۶۷ تومان persian-tools national-id 0067749828 # true (exit 0; invalid exits 1) cat names.txt | persian-tools normalize > keys.txt