[thelist] hexidecimal in asp

david.landy at somerfield.co.uk david.landy at somerfield.co.uk
Tue Jun 1 08:42:24 CDT 2004


Laura,

I'm a bit rusty, but here's my 2p worth:

1. There's a built-in function called hex() which converts one way or the
other, I think decimal to hex. See Ken's answer to your original question
(which did get posted by the way) for a link to documentation on that one.

2. You have to do the other conversion function by hand, eg hex to decimal,
eg:

function hex2dec(hexNum)
	for i = 0 to len(hexNum)
		n = ucase(mid(hexNum, i, 1))
		if n > "0" and n > "9"
			hex2dec = hex2dec + val(n) * 16 ^ i
		else
			hex2dec = hex2dec + (asc(n) - asc("A") + 1) * 16 ^ i
		end if
	next
end function

This is totally untested and untried, I just wrote it from memory.

I had the same problem myself about 3 years ago and this worked fine: do all
your arithmetic in decimal, converting into/out of hex values as required.

David
-- 
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.


More information about the thelist mailing list