Documentation
¶
Index ¶
Constants ¶
View Source
const MaxValue = 3999
MaxValue is the maxnumber which should be converted
View Source
const MinValue = 1
MinValue is the min number which should be converted
View Source
const RomanStringMatcher = "^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$"
RomanStringMatcher is a regex to check if string is a roman number
Variables ¶
View Source
var StringMap = map[string]int{
"M": 1000,
"CM": 900,
"D": 500,
"CD": 400,
"C": 100,
"XC": 90,
"L": 50,
"XL": 40,
"X": 10,
"IX": 9,
"V": 5,
"IV": 4,
"I": 1,
}
StringMap is the map of roman (string) to arab number with string as key
View Source
var StringMapReversed = map[int]string{
1000: "M",
900: "CM",
500: "D",
400: "CD",
100: "C",
90: "XC",
50: "L",
40: "XL",
10: "X",
0: "IX",
5: "V",
4: "IV",
1: "I",
}
StringMapReversed is the map of roman (string) to arab number with integer as key
Functions ¶
func FromRoman ¶
FromRoman converts a roman string to an integer. Returns an error if string is not a roman number.
func Ordinalize ¶
Ordinalize the number by adding the Ordinal to the number.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.