Strings to Hex

Hi,
This one I’m struggling for. I need to feed it a string which gets converted to hex and vice versa.

For example the string of %hello converted is 2568656c6c6f
I’ve briefly skinned the documentation and API but can’t find what I need. Maybe IO::HexDump?

As an bolt on question, I have a text file with hexString1 | hexString2 | hexString3
Would IO::Delimited be the class required for splitting these values in to their representative variables?

ty
Mookie

There might be a better way but this is what i came up with. https://play.crystal-lang.org/#/r/754i

Mm maybe. Might just be easier to do like data = File.read("file").split('|'). This would make an array of each hex string.

1 Like

Thank you for your quick reply.