paul-english / scala-overpunch   1.0.3

MIT License GitHub

Decode/encode the overpunch format

Scala versions: 2.11

Decode (and encode if you really want to) overpunch formatted numbers into decimals. This library is a simple port of the logic from the python overpunch library.


import com.github.log0ymxm.Overpunch

Overpunch.decode("10}", decimals=0) == BigDecimal("-100")
Overpunch.decode("45A", decimals=0) == BigDecimal("451")
Overpunch.decode("1000}") == BigDecimal("-100.00")


  • I ported over the original python tests, and they all pass. I've added some rigorous scalacheck tests, but they currently don't pass. The library is probably usable, scalacheck seems to be just hitting the less likely edge cases.