Skip to content

Roman numerals parser (Go)

License

Notifications You must be signed in to change notification settings

ghen/roman-numerals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roman numerals parser (Go)

Implements a Roman type that supports text marshalling / unmarshalling.

Usage

  import (
    "fmt"
    
    "github.com/ghen/roman-numerals/roman"
  )

  func main() {

    var r Roman
    if err := r.UnmarshalText([]byte("XIV")); err != nil {
      panic(err)
    }

    fmt.Printf("%s = %d", r.String(), r.Value)
  }

Notes

Not covered in roman package:

  • Text tokenization (trim the whitespace before parsing the value)
  • Text normalization (only upper case ASCII characters are accepted)
  • Validation (roman number characters are parsed as long as they do not exceed the maximum allowed value of 3,999)

About

Roman numerals parser (Go)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages