Some utilities for Persian language in Go (Golang)

Overview

persian

cover.run go Go Report Card GoDoc

Some utilities for Persian language in Go (Golang).

Installation

go get github.com/mavihq/persian

API

.ToPersianDigits

Converts all English digits in the string to Persian digits.

persian.ToPersianDigits("123salam456")
=> "۱۲۳salam۴۵۶"

.ToPersianDigitsFromInt

Converts integer value to string with Persian digits.

persian.ToPersianDigitsFromInt(123)
=> "۱۲۳"

.ToEnglishDigits

Converts all Persian digits in the string to English digits.

persian.ToEnglishDigits("۱۲۳salam۴۵۶")
=> "123salam456"

.OnlyEnglishNumbers

Extracts only English digits from string.

persian.OnlyEnglishNumbers("123salam۴۵۶")
=> "123"

.OnlyPersianNumbers

Extracts only Persian digits from string.

persian.OnlyPersianNumbers("123salam۴۵۶")
=> "۴۵۶"

.SwitchToPersianKey

Converts English chars to their equivalent Persian char on keyboard.

persian.SwitchToPersianKey("sghl o,fd ? o,fl llk,k")
=> "سلام خوبی ؟ خوبم ممنون"

.SwitchToEnglishKey

Converts Persian chars to their equivalent English char on keyboard.

persian.SwitchToEnglishKey("اثغ صاشفس عح ؟")
=> "hey whats up ?"

.Currency

Formats number to Persian currency style.

persian.Currency("1234567")
=> "۱،۲۳۴،۵۶۷"

.Toman

Formats number to Persian currency style with تومان postfix.

persian.Toman("1234567")
=> "۱،۲۳۴،۵۶۷ تومان"

.Rial

Formats number to Persian currency style with ﷼ postfix.

persian.Rial("1234567")
=> "۱،۲۳۴،۵۶۷ ﷼"

.FixArabic

Used for converting Arabic characters to Persian.

persian.FixArabic("علي")
=> "علی"
You might also like...
If you accept that 1 day is 24 hours in some situations, you might want to parse it in Go too.

relaxduration If you accept that 1 day is 24 hours in some situations, you might want to parse it in Go too. This package tries to handle situations w

A modern programming language written in Golang.

MangoScript A modern programming language written in Golang. Here is what I want MangoScript to look like: struct Rectangle { width: number he

A toy language parser, lexer and interpreter written in Golang

Monkey - A toy programming language Monkey is a toy programming language used to learn how to write a lexer, parser and interpreter. The language is i

Go-linq - A powerful language integrated query (LINQ) library for Golang

go-linq A powerful language integrated query (LINQ) library for Go. Written in v

Unit tests generator for Go programming language
Unit tests generator for Go programming language

GoUnit GoUnit is a commandline tool that generates tests stubs based on source function or method signature. There are plugins for Vim Emacs Atom Subl

FreeSWITCH Event Socket library for the Go programming language.

eventsocket FreeSWITCH Event Socket library for the Go programming language. It supports both inbound and outbound event socket connections, acting ei

Simple interface to libmagic for Go Programming Language

File Magic in Go Introduction Provides simple interface to libmagic for Go Programming Language. Table of Contents Contributing Versioning Author Copy

Go language interface to the PAPI performance API

go-papi Description go-papi provides a Go interface to PAPI, the Performance Application Programming Interface. PAPI provides convenient access to har

go language generics system

Gotgo This document describes the third iteration of my attempt at a reasonable implementation of generics for go based on the idea of template packag

Comments
  • Fix FixArabic and add Normalize function

    Fix FixArabic and add Normalize function

    ZWJ and ZWNJ are valid characters in Persian strings so these characters do not need to replace in FixArabic strings. Normalize function added for sorting and check equality according to Persian Collation that need completion based on unicode documents

    opened by sadeqn 0
Releases(v1.2)
Owner
هلو | آموزش زبان با بازی
یادگیری زبان مثل هلو برو تو گلو
هلو | آموزش زبان با بازی
This repository provides various utilities to help you build your NFT collection!

Attention! A powerful computer may be required! About This repository provides various utilities to help you build your NFT collection: Generate image

Igor Savenko 6 Nov 4, 2022
Go module that provides primitive functional programming utilities.

Functional Functional provides a small set of pure functions that are common in functional programming languages, such as Reduce, Map, Filter, etc. Wi

Liam Mueller 1 Jun 12, 2022
Some plain Go/Golang i2c sensor bindings to Waveshare Sense HAT for raspberry pi

i2c some plain Go/Golang i2c sensor bindings to Waveshare Sense HAT for raspberry pi using https://periph.io Supported hardware: Raspberry Zero W 1 ht

Torben Schinke 0 Dec 31, 2021
In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

Hamid Hosseinzadeh 1 May 19, 2022
Functional programming library for Go including a lazy list implementation and some of the most usual functions.

functional A functional programming library including a lazy list implementation and some of the most usual functions. import FP "github.com/tcard/fun

Toni Cárdenas 31 May 21, 2022
Some helper types for go1: priority queue, slice wrapper.

go-villa Package villa contains some helper types for Go: priority queue, slice wrapper, binary-search, merge-sort. GoDoc Link: http://godoc.org/githu

Yi Deng 53 Apr 24, 2021
Some gophers 🐻

Gophers ?? Hey ?? ! Here are some drawings I have been using for talks about Golang. These are mainly gophers, but also some dukes, and miscellaneous.

Nicolas Lepage 83 Nov 15, 2022
Some examples of testing techniques and commonly used frameworks

golang-test-examples Some examples of testing techniques and commonly used frameworks Test frameworks Testify Ginkgo Convey godog (cucumber) Test exam

Armakuni 0 Oct 29, 2021
Some convenient string functions.

str Some convenient string functions. What This package containsa couple of functions to remove duplicates from string slices and optionally sort them

Grimdork.net 1 Dec 27, 2021
This contains some example (micro)service

This contains some example (micro)service. It should expose some of the issues when tyring to put too much logic into one file or to mix things that should not be mixed together.

Peter 0 Jan 11, 2022