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

Overview

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/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

This method has two key : bankName and isValid If the bank account number is not valid, bankName will be empty

card:= Card{Number:"6219861034529008"}
falseResult := card.CardInfo() // { false} -> bankName: "", isValid:  false
card= Card{Number:"6037701689095443"}
bankKeshavarzi := card.CardInfo() // {بانک کشاورزی true} -> bankName: "بانک کشاورزی", isValid:  true
card= Card{Number:"6219861034529007"}
bankSaman := card.CardInfo() // {بانک سامان true} -> bankName: "بانک سامان", isValid:  true
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
You might also like...
A simple programming language with emojis only

MOGEE mogee (pronounced ēˈmōjē) is an extremely simple interpreted programming language that consists solely of emojis. Similar to Brainfuck, mogee is

Toy scripting language with a syntax similar to Rust.

Dust - toy scripting language Toy scripting language with a syntax similar to Rust. 👍 Syntax similar to Rust 👍 Loose JSON parsing 👍 Calling host fu

Build "Dictionary of the Old Norwegian Language" into easier-to-use data formats

Old Norwegian Dictionary Builder Build "Dictionary of the Old Norwegian Language" into easier-to-use data formats. Available formats: JSON DSL XML Usa

Interpreted Programming Language built in Go. Lexer, Parser, AST, VM.

Gago | Programming Language Built in Go if you are looking for the docs, go here Gago is a interpreted programming language. It is fully written in Go

[Crawler/Scraper for Golang]🕷A lightweight distributed friendly Golang crawler framework.一个轻量的分布式友好的 Golang 爬虫框架。

Goribot 一个分布式友好的轻量的 Golang 爬虫框架。 完整文档 | Document !! Warning !! Goribot 已经被迁移到 Gospider|github.com/zhshch2002/gospider。修复了一些调度问题并分离了网络请求部分到另一个仓库。此仓库会继续

golang 在线预览word,excel,pdf,MarkDown(Online Preview Word,Excel,PPT,PDF,Image by Golang)
golang 在线预览word,excel,pdf,MarkDown(Online Preview Word,Excel,PPT,PDF,Image by Golang)

Go View File 在线体验地址 http://39.97.98.75:8082/view/upload (不会经常更新,保留最基本的预览功能。服务器配置较低,如果出现链接超时请等待几秒刷新重试,或者换Chrome) 目前已经完成 docker部署 (不用为运行环境烦恼) Wor

bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS

bluemonday bluemonday is a HTML sanitizer implemented in Go. It is fast and highly configurable. bluemonday takes untrusted user generated content as

Elegant Scraper and Crawler Framework for Golang

Colly Lightning Fast and Elegant Scraping Framework for Gophers Colly provides a clean interface to write any kind of crawler/scraper/spider. With Col

A golang package to work with Decentralized Identifiers (DIDs)

did did is a Go package that provides tools to work with Decentralized Identifiers (DIDs). Install go get github.com/ockam-network/did Example packag

Comments
  • change errors to defined errors for better error handling

    change errors to defined errors for better error handling

    this is good for better error handling

    example:

    if _, err := bank.CardInfo("abcd"); errors.Is(err, bank.ErrInvalidCard) {
         fmt.Println("your card hasn't valid format, try again...")
    }
    
    opened by sina-devel 0
  • fix several problems in CardInfo()

    fix several problems in CardInfo()

    I wanted to use Card Info but this has some problem. Decision create list problem Card Info & resolve it.

    1. exposed function has unexposed response.
    2. fill some bank does not exist in bank list.
    opened by masihtehrani 0
  • add condition for some national code exception

    add condition for some national code exception

    hi due to some nice features in the javascript project, I sync one feature that js version previously supported some exceptional national codes added to the national_code validation function with tests

    opened by pooooriya 1
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .circleci/config.yml (circleci)
    • Dockerfile (dockerfile)
    • .github/workflows/codecov.yml (github-actions)
    • .github/workflows/go.yml (github-actions)
    • go.mod (gomod)

    Configuration

    🔡 Renovate has detected a custom config for this PR. Feel free to ask for help if you have any doubts and would like it reviewed.

    Important: Now that this branch is edited, Renovate can't rebase it from the base branch any more. If you make changes to the base branch that could impact this onboarding PR, please merge them manually.

    What to Expect

    With your current configuration, Renovate will create 6 Pull Requests:

    Update github.com/mavihq/persian digest to 7c4f376
    • Schedule: ["at any time"]
    • Branch name: renovate/github.com-mavihq-persian-digest
    • Merge into: master
    • Upgrade github.com/mavihq/persian to 7c4f3764aa6bec6fae1f4392555addb4da5ac6e0
    Update circleci/golang Docker tag to v1.17
    • Schedule: ["at any time"]
    • Branch name: renovate/circleci-golang-1.x
    • Merge into: master
    • Upgrade circleci/golang to 1.17
    Update module go to 1.19
    • Schedule: ["at any time"]
    • Branch name: renovate/go-1.x
    • Merge into: master
    • Upgrade go to 1.19
    Update module moul.io/number-to-words to v0.7.0
    • Schedule: ["at any time"]
    • Branch name: renovate/moul.io-number-to-words-0.x
    • Merge into: master
    • Upgrade moul.io/number-to-words to v0.7.0
    Update actions/checkout action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-checkout-3.x
    • Merge into: master
    • Upgrade actions/checkout to v3
    Update actions/setup-go action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-setup-go-3.x
    • Merge into: master
    • Upgrade actions/setup-go to v3

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
Owner
Persian Tools
PersianTools.js is a standalone, library-agnostic JavaScript that enables some of the Persian features for use in the JavaScript.
Persian Tools
Tools to help with Japanese sentence mining

Tools to help with Japanese sentence mining

Anton Van Eechaute 2 Oct 25, 2022
Parses the Graphviz DOT language in golang

Parses the Graphviz DOT language and creates an interface, in golang, with which to easily create new and manipulate existing graphs which can be writ

Walter Schulze 506 Dec 25, 2022
Frongo is a Golang package to create HTML/CSS components using only the Go language.

Frongo Frongo is a Go tool to make HTML/CSS document out of Golang code. It was designed with readability and usability in mind, so HTML objects are c

Rewan_ 21 Jul 29, 2021
Go library for the TOML language

go-toml Go library for the TOML format. This library supports TOML version v1.0.0-rc.3 Features Go-toml provides the following features for using data

Thomas Pelletier 1.4k Dec 27, 2022
Guess the natural language of a text in Go

guesslanguage This is a Go version of python guess-language. guesslanguage provides a simple way to detect the natural language of unicode string and

Nikita Vershinin 56 Dec 26, 2022
String i18n utilities for the Go Programming Language

About polyglot polyglot is a String translation package and tool for Go. Setup Make sure you have a working Go installation. See Getting Started Now r

Alexander Neumann 40 Dec 22, 2022
Unified text diffing in Go (copy of the internal diffing packages the officlal Go language server uses)

gotextdiff - unified text diffing in Go This is a copy of the Go text diffing packages that the official Go language server gopls uses internally to g

Hexops 96 Dec 26, 2022
Simple HCL (HashiCorp Configuration Language) parser for your vars.

HCL to Markdown About To write a good documentation for terraform module, quite often we just need to print all our input variables as a fancy table.

Dmytro Shamenko 15 Dec 14, 2021
The Freetype font rasterizer in the Go programming language.

The Freetype font rasterizer in the Go programming language. To download and install from source: $ go get github.com/golang/freetype It is an incom

Go 699 Dec 25, 2022
👄 The most accurate natural language detection library in the Go ecosystem, suitable for long and short text alike

?? The most accurate natural language detection library in the Go ecosystem, suitable for long and short text alike

Peter M. Stahl 822 Dec 25, 2022