Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

romannum state

Back to all declarations

romanUnits

[]struct{...} (len=13)

romanUnits is the greedy subtractive-notation table, largest value first.

Open
OID
0eb46e…ba76:4
romanUnits details (len=13)

+13 more Inspect slice

ToRoman

func(n int) string

ToRoman renders an integer in 1..3999 as a Roman numeral. It panics if n is out of range.

Open
OID
0eb46e…ba76:18
ToRoman details

Inspect func

FromRoman

func(s string) int

FromRoman parses a Roman numeral back to an integer. It panics on any malformed input (e.g. "IIII", "IC", "VV").

Open
OID
0eb46e…ba76:20
FromRoman details

Inspect func

charVal

func(c uint8) int

charVal maps a single Roman digit to its value, or 0 if unknown.

Open
OID
0eb46e…ba76:21
charVal details

Inspect func

parseRoman

func(s string) (int, bool)

parseRoman is the pure, panic-free core used by FromRoman and Render. It returns (value, true) only for a canonical numeral: it accepts input iff ToRoman(value) reproduces it exactly, which rejects malformed forms.

Open
OID
0eb46e…ba76:22
parseRoman details

Inspect func

examples

[]int (len=13)

examples are the classic milestones shown by the root Render.

Open
OID
0eb46e…ba76:24
examples details (len=13)

+13 more Inspect slice

Render

func(path string) string

Render drives gnoweb: - "" or "/" → a table of example conversions - "/\<n>" → integer → Roman - "/r/\<roman>" → Roman → integer

Open
OID
0eb46e…ba76:25
Render details

Inspect func

renderToRoman

func(arg string) string
Open
OID
0eb46e…ba76:26
renderToRoman details

Inspect func

renderFromRoman

func(arg string) string
Open
OID
0eb46e…ba76:27
renderFromRoman details

Inspect func
romanUnits : []struct{...} (len=13) Inspect
ToRoman : func(n int) string Inspect
FromRoman : func(s string) int Inspect
charVal : func(c uint8) int Inspect
parseRoman : func(s string) (int, bool) Inspect
examples : []int (len=13) Inspect
Render : func(path string) string Inspect
renderToRoman : func(arg string) string Inspect
renderFromRoman : func(arg string) string Inspect
renderTable : func() string Inspect
usage : func() string Inspect