| View previous topic :: View next topic |
| Author |
Message |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Jul 01, 2003 12:11 am Post subject: hexdec |
|
|
Is there a function in VDS that does that same thing as PHP's function
hexdec() does?
http://www.php.net/hexdec _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Jul 01, 2003 12:39 am Post subject: |
|
|
I don't think there is, but you can use:
| Code: |
%%hex = @HEX(123)
GOSUB Hex2Dec
INFO %%decimal
exit
:Hex2Dec
%%decimal = 0
%%decx = 1
repeat
%%decchar = @UPPER(@SUBSTR(%%hex,%%decx,%%decx))
%%decpos = @FSUB(@POS(%%decchar,"0123456789ABCDEF"),1)
%%decimal = @FADD(@FMUL(%%decimal,16),%%decpos)
%%decx = @SUCC(%%decx)
until @GREATER(%%decx,@LEN(%%hex))
exit
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Tue Jul 01, 2003 12:59 am Post subject: |
|
|
I'm not sure if this is what you mean, but it's probably very simple (this has been
mentioned on this forum before too):
| Code: |
%%dec = @diff($%%hex,0)
|
|
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Jul 01, 2003 12:25 pm Post subject: |
|
|
Thank you both. This helped me a lot.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jul 02, 2003 1:38 pm Post subject: |
|
|
| Tommy wrote: | I'm not sure if this is what you mean, but it's probably very simple (this has been
mentioned on this forum before too):
| Code: |
%%dec = @diff($%%hex,0)
|
|
Tommy,
I think you should use
%%dec = @sum($%%hex,0)
Adding is always faster than subtracting for a computer if you have lots of conversions to do that is. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
|