I see there is a way of turning Decimal to Hex. Is there a way to turn it back from Hex to Decimal?
red
Hex to Decimal
Started by
redndahead
, Jan 19 2004 06:16 PM
3 replies to this topic
#1
Posted 19 January 2004 - 06:16 PM
#2
Posted 19 January 2004 - 07:31 PM
Not built in, but you can feed the string from Hex() back into this func:
/EDIT: removed use of ^ operator: Jon, this is straight forward to do in C.
Func Hex2Dec($number) $len = StringLen($number) $number = StringUpper($number) $ret = 0 $fac = 1 For $i = $len To 1 Step -1 $n = Asc(StringMid($number, $i, 1)) - 48 If $n > 9 Then $n = $n - 7 $ret = $ret + ($n * $fac) $fac = $fac * 16 Next Return $ret EndFunc
/EDIT: removed use of ^ operator: Jon, this is straight forward to do in C.
Edited by tylo, 20 January 2004 - 07:02 AM.
blub
#3
Posted 19 January 2004 - 07:55 PM
I should make that built in really.
This list is getting longer. Arrgrgh.
This list is getting longer. Arrgrgh.
#4
Posted 19 January 2004 - 10:48 PM
Thanks Tylo that was exactly what i needed...
I would appreciate it jon that will cut out some unnecessary code.
Thanks everybody again. Give my password encryption program a try.
red
I would appreciate it jon that will cut out some unnecessary code.
Thanks everybody again. Give my password encryption program a try.
red
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





