forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


hexdec

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Jul 01, 2003 12:11 am    Post subject: hexdec Reply with quote

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
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Jul 01, 2003 12:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Tue Jul 01, 2003 12:59 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Jul 01, 2003 12:25 pm    Post subject: Reply with quote

Thank you both. This helped me a lot. Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed Jul 02, 2003 1:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group