red-system

How to represent a hex string in Red/System?


How would one represent a literal string of binary data in hex in Red/System?

It's not possible to do this:

blah: #{F0909090F02060202070F010F080F0F010F010F09090F01010F080F010F0F080F090F0F010204040F090F090F0F090F010F0F090F09090E090E090E0F0808080F0E0909090E0F080F080F0F080F08080}

Solution

  • For now, using a string, one can encode literal bytes with escape notation "^(00)":

    blah: "^(F0)^(90)^(90)^(90)^(F0)^(20)^(60)^(20)^(20)^(70)^(F0)^(10)^(F0)^(80)^(F0)^(F0)^(10)^(F0)^(10)^(F0)^(90)^(90)^(F0)^(10)^(10)^(F0)^(80)^(F0)^(10)^(F0)^(F0)^(80)^(F0)^(90)^(F0)^(F0)^(10)^(20)^(40)^(40)^(F0)^(90)^(F0)^(90)^(F0)^(F0)^(90)^(F0)^(10)^(F0)^(F0)^(90)^(F0)^(90)^(90)^(E0)^(90)^(E0)^(90)^(E0)^(F0)^(80)^(80)^(80)^(F0)^(E0)^(90)^(90)^(90)^(E0)^(F0)^(80)^(F0)^(80)^(F0)^(F0)^(80)^(F0)^(80)^(80)"