roman

package module
v0.0.0-...-eeb88e8 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2015 License: MIT Imports: 1 Imported by: 0

README

go-roman Build Status GoDoc

Golang library to manipulate roman numbers.

Documentation

Index

Constants

View Source
const (
	O = 0
	I = 1
	V = 5
	X = 10
	L = 50
	C = 100
	D = 500
	M = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RomanNumber

type RomanNumber []RomanSymbol

RomanNumber represents a sequence of valid RomanSymbols

func FromInt

func FromInt(n int32) RomanNumber

FromInt returns the RomanNumber value of the given number

func FromString

func FromString(s string) (RomanNumber, error)

FromString returns the RomanNumber after parsing the given string

func (RomanNumber) IsValid

func (n RomanNumber) IsValid() bool

IsValid returns true only if the sequence of RomanSymbols contained in the number is a valid roman number

func (RomanNumber) Value

func (n RomanNumber) Value() int32

Value returns the int32 value of the roman number

type RomanSymbol

type RomanSymbol int

RomanSymbol is the representation of one of the symbols used to represent a roman number

func SymbolFromRune

func SymbolFromRune(r rune) (RomanSymbol, error)

SymbolFromRune returns the RomanSymbol that matches the given rune

func SymbolFromString

func SymbolFromString(s string) (RomanSymbol, error)

SymbolFromString returns the RomanSymbol that matches the given character. Only the first character will be used if a string with more than one character is passed

Jump to

Keyboard shortcuts

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