numalph_go

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 3 Imported by: 0

README

Persian Number Converter

This Golang package converts numeric values to their corresponding Persian alphabetic representation. It supports numbers.

Installation

To use this package, run:

go get github.com/mohammad-safakhou/numalph-go

Usage

First, import the package in your Go file:

import "github.com/mohammad-safakhou/numalph-go"

Then, you can use the NumToPersian function to convert integers to Persian words:

fmt.Println(persianNumber)

Examples

Here are some examples of how to use the NumToPersian function:

package main

import (
    "fmt"

    numtopersian "github.com/mohammad-safakhou/numalph-go"
)

func main() {
    fmt.Println(numtopersian.NumToPersian(0))           // Output: صفر
    fmt.Println(numtopersian.NumToPersian(7))           // Output: هفت
    fmt.Println(numtopersian.NumToPersian(42))          // Output: چهل و دو
    fmt.Println(numtopersian.NumToPersian(1999))        // Output: یک هزار و نهصد و نود و نه
    fmt.Println(numtopersian.NumToPersian(-256))        // Output: منفی دویست و پنجاه و شش
    fmt.Println(numtopersian.NumToPersian(1000000))     // Output: یک میلیون
    fmt.Println(numtopersian.NumToPersian(123456789))   // Output: یکصد و بیست و سه میلیون و چهارصد و پنجاه و شش هزار و هفتصد و هشتاد و نه
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NumToPersian

func NumToPersian(input string) string

NumToPersian converts a numerical string into its Persian word representation.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL