0

raw beginner with scodec here. Does scodec provide a nice way to convert an unsigned decimal integer value to a literal binary unsigned integer string with length specified as an input, left-padding with zeroes as needed up to the specified length? If so, what would that be? Many thanks...

Sample pseudocode:
{convert(unsignedDecimalIntValue = 5, bitCount = 6) => "000101"}

1 Answers1

0

Colt Frederickson kindly answered this on Gitter for the particular case in my example above:

BitVector.fromInt(5).takeRight(6).toBin 

Generalizing the Int arguments to the terms of my pseudocode,

BitVector.fromInt(unsignedDecimalIntValue).takeRight(bitCount).toBin