[REBOL] Converting a hex string into an integer
From: gavin:mckenzie:sympatico:ca at: 12-Jul-2001 15:26
*sigh*
Just when you think you've got the knack of this language, something
seemingly simple stumps ya'.
Given:
>> a: "#x3c"
== "#x3c"
I now want to convert the "3c" (hex) portion of the string into its decimal
value. I've read up on to-integer, debase, and countless other parts of the
dictionary and user guide. I'm sure there is a really simple way to do
this, but so far all I've come up with is:
>> to-integer do do [rejoin ["#{" next next a "}"]]
== 60
I look forward to being wholly and completely shamed...please.
Gavin.