mirror of
https://github.com/rwinkhart/convertroman.git
synced 2026-09-05 16:37:22 -04:00
updated docs
This commit is contained in:
@@ -2,26 +2,40 @@
|
||||
|
||||
[](https://pkg.go.dev/github.com/brandenc40/romannumeral)
|
||||
|
||||
Convert to and from roman numerals in Go.
|
||||
Quickly and efficiently convert to and from roman numerals in Go.
|
||||
|
||||
### Benchmark Results
|
||||
|
||||
```sh
|
||||
goos: darwin
|
||||
goarch: arm64
|
||||
pkg: github.com/brandenc40/romannumeral
|
||||
BenchmarkToRomanNumeral
|
||||
BenchmarkToRomanNumeral-8 10997846 108.5 ns/op
|
||||
BenchmarkToInteger
|
||||
BenchmarkToInteger-8 18861016 62.29 ns/op
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/brandenc40/romannumeral"
|
||||
rom "github.com/brandenc40/romannumeral"
|
||||
)
|
||||
|
||||
func ExampleToInt() {
|
||||
integer, err := romannumeral.ToInt("IV")
|
||||
func ExampleRomanToInt() {
|
||||
integer, err := rom.ToInt("IV")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(integer == 4)
|
||||
}
|
||||
|
||||
func ExampleFromInt() {
|
||||
roman, err := romannumeral.FromInt(4)
|
||||
func ExampleIntToRoman() {
|
||||
roman, err := rom.FromInt(4)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user