Economy-x-Talk - Sample Scripts
DecToHex
Jon Bettancourt's decimal-to-hexadecimal handlers look like they should
do
the job, but I find it somewhat inaesthetic that he's got different handlers
for bytes (= 2 hex digits), words (= 4 hex digits) and long words (= 8 hex
digits). Thus, here's a handler which should work for all positive decimal
integers.
The core of this handler is the "Numbr mod 16" line at the start of the
loop, of course.
Hope this helps...
Cubist
on doDec2Hex
get dec2Hex(16*15)
return it
end doDec2Hex
function Dec2Hex Numbr
put "0123456789ABCDEF" into Digitz
put "" into DaRezult
repeat
put char ((Numbr mod 16) + 1) of Digitz before DaRezult
put Numbr div 16 into Numbr
if Numbr = 0 then exit repeat
end repeat
return DaRezult
end Dec2Hex
Keep this extensive resource of tutorials and samples on-line! Support RunRev.info!
| Yes, this script is useful. I make a donation and choose freely how much I want to donate on-line (PayPal). Click here if you want to make a donation in dollars. | This script has not (completely) solved my problem and I want Economy-x-Talk to take care of it. Let me contact you. |
Copyright©2002-2008 by Mark Schonewille, Nijmegen, the Netherlands. This web site is in no way affiliated with Runtime Revolution Ltd., but we do recommend the Revolution development platform.