Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Binary equivalent of a number


Message #1 by Dennis <dennist@g...> on Fri, 11 Oct 2002 13:06:16 +0530
Hi everyone,
                  Does anyone know how to extract the Binary equivalent of a given number in ASP?

For example, in PHP there is a function decbin(param1) which renders the Binary equivalent of the given parameter.

Is there any equivalent function in ASP?

For Example :

decbin(4)=100
decbin(7)=111
etc.

regards,
Dennis.
Message #2 by "phil griffiths" <pgtips@m...> on Mon, 14 Oct 2002 14:39:43
Hi Dennis,

Depends which language you write your ASP in.  If you use JScript, then 
both parseInt and toString functions will convert to binary, e.g:
var n = 4;
var s = n.toString(2); // 2 is the 'base', so s = "100"

If you use VBS you'll have to write your own - I've got one somewhere, 
can't seem to lay my hands on it at the mo and don't have time to re-
create it.  Let me know if you need it and I'll have a longer search...

rgds
Phil
>----------------------------------------------
> Hi everyone,
                  Does anyone know how to extract the Binary equivalent of 
a given number in ASP?

For example, in PHP there is a function decbin(param1) which renders the 
Binary equivalent of the given parameter.

Is there any equivalent function in ASP?

For Example :

decbin(4)=100
decbin(7)=111
etc.

regards,
Dennis.

  Return to Index