convert

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

godoc codecov Go Report Card

convert - convert things to other forms of the same thing

convert is a package for converting things like integers into roman numerals.

Installation

> go get github.com/go-corelibs/convert@latest

Examples

ToLetters, ToRoman

func main() {
    letters := convert.ToLetters(34)
    // letters == "ai"
    roman := convert.ToRoman(34)
    // roman == "XXXIV"
}

Go-CoreLibs

Go-CoreLibs is a repository of shared code between the Go-Curses and Go-Enjin projects.

License

Copyright 2023 The Go-CoreLibs Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use file except in compliance with the License.
You may obtain a copy of the license at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaximumRomanNumber = 3999
)

Functions

func ToCharacters

func ToCharacters[T maths.Integers](number T, base string) (letters string)

func ToLetters

func ToLetters[T maths.Integers](number T) (letters string)

func ToRoman

func ToRoman(number int) (numerals string)

Types

type DigitValue

type DigitValue struct {
	Value int
	Digit string
}

type DigitValues

type DigitValues []DigitValue

func ListRomanNumerals

func ListRomanNumerals() (numerals DigitValues)

func (DigitValues) Sort

func (r DigitValues) Sort() (sorted DigitValues)

Sort returns a reverse sorted copy of the DigitValues

Jump to

Keyboard shortcuts

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