algorithmic

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package algorithmic implements parsing and formatting of non-decimal number systems, such as roman numerals and traditional tamil numbers.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(name string, number int64) (string, error)
Example
package main

import (
	"fmt"

	"github.com/tawesoft/golib/v2/text/number/algorithmic"
)

func main() {
	print := func(system string, n int64) {
		if s, err := algorithmic.Format(system, n); err == nil {
			fmt.Printf("algorithmic.Format(%q, %d): %q\n", system, n, s)
		} else {
			fmt.Printf("algorithmic.Format(%q, %d): error: %v\n", system, n, err)
		}
	}

	print("%roman-upper", 2023)

}
Output:

algorithmic.Format("%roman-upper", 2023): "MMXXIII"

Types

This section is empty.

Jump to

Keyboard shortcuts

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