note 76660 deleted from function.decbin by nlopess
| From: | nlopess@php.net | Date: | Wed, 25 Jul 2007 10:33:22 +0000 |
| Subject: | note 76660 deleted from function.decbin by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-128911@lists.php.net to get a copy of this message | ||
Note Submitter: ViniciusCainelli at gmail dot com
----
Usar decbin no JavaScript:
function decbin(numero)
{
if (parseInt(numero) . toString() == 'NaN')
return false;
var resto = '';
while (Math . floor(numero) != 0) {
resto += numero % 2;
numero = Math . floor(numero / 2);
}
return strrev(resto);
}
function strrev(string)
{
if (string == undefined)
return false;
var string = string . toString();
var a = string . length;
var retorno = '';
while (a != 0) {
retorno += string . charAt(--a);
}
return retorno;
}
Obrigado PHP.net!
MSN: msn@viniciuscainelli.com