[REBOL] Re: to-hex
From: hallvard::ystad::helpinhand::com at: 11-Sep-2001 16:19
pekr wrote (Tuesday 11.09.2001, at 11.24):
>load rejoin ["#{" "F2" "}"] - that cludgy way you get binary :-) then you
>can convert to integer
>[...]
>maybe 'debase could help you, but it is buggy in current rebol
>implementation ...
I've been looking at debase too, but as you say, it's buggy. If I were to
convert hex characters manually in java (that's where I "come from"), I'd
use a switch statement. Any suggestions to how I should do it in
rebol? Here's a java sample:
switch (character) {
case ('0')
return "0000"
case ('1')
return "0001"
case ('2')
return "0010"
(...)
case ('d')
return "1101"
case ('e')
return "1110"
case ('f')
return "1111"
}
Obviously, this should be done with a one-liner, but since debase is so
hard to figure out, I'm willing to do a little more work. Any help greatly
appreciated.
~H