contextual

simple and typesafe interpolated strings, checked at compile-time

Package Information

SBT

"com.propensive" %% "contextual-examples" % "1.0.0"

License

Apache 2.0

Source code

Defined contexts

None

Predefined substitution types

None

Hexadecimal byte arrays (hex"")

Features

  • Parses hexadecimal data
  • Checks data is an exact number of bytes long
  • Optimized construction of a new array without any heap allocation
  • Does not support substitutions

Examples

> import contextual.examples.hex._
> hex"""000102030405060708090a0b0c0d0e0f"""
res: Array[Byte] = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
> import contextual.examples.hex._
> hex"""cafebabe"""
res: Array[Byte] = Array(-54, -2, -70, -66)
> import contextual.examples.hex._
> hex"""2a"""
res: Array[Byte] = Array(42)