Documentation ¶
Index ¶
Constants ¶
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