[REBOL] Re: noob question -- insert 2 byte hexidecimal value into binary string
From: carl:cybercraft at: 15-Apr-2008 20:00
Hi Doug,
Here's a method of getting individual bytes or characters from a hex value...
>> hex: to-hex length? "Fred Flintstone and Wilma Flintstone"
== #00000024
>> to-integer copy/part skip hex 6 2
== 36
>> to-char to-integer copy/part skip hex 6 2
== #"$"
>> to-integer copy/part skip hex 4 2
== 0
>> to-char to-integer copy/part skip hex 4 2
== #"^-"
Obviously Anton's approach is much shorter for your specific problem, but the above at
least shows there's a relatively pure way in REBOL to extract bytes from a hex value.
-- Carl Read.
On Tuesday, 15-April-2008 at 15:38:49 Anton Rolls wrote,