In cadence you can have a hex string say "776f6f74"
which you can then use decodeHex
with to get a [UInt8]
which would give you [119, 111, 111, 116]
let hexString = "776f6f74"
let hexArray = hexString.decodeHex()
assert(hexArray == [119, 111, 111, 116])
I am looking for a way in cadence to do the inverse, go from [119, 111, 111, 116]
to the hexString of "776f6f74"
let hexArray = [119, 111, 111, 116]
let hexString = lookingForThisFunction(hexArray)
assert(hexString == "776f6f74")
// so that
let hex = "776f6f74"
assert(lookingForThisFunction(hex.decodeHex()) == hex)
My questions:
- does
lookingForThisFunction
from the above example exist? - if it doesnβt exist, is there a straight forward way for me to make it exist in cadence?