Leading Zeros in Binary

Camm29 Camm29 at tesco.net
Thu Nov 17 16:30:08 EST 2005


Perfect , Thanks

----- Original Message -----
From: "Alex Tweedly" <alex at tweedly.net>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Thursday, November 17, 2005 9:03 PM
Subject: Re: Leading Zeros in Binary


> Camm29 wrote:
>
> >Help !!!! Please
> >
> >When using baseConvert ("00FFFFFF" , 16 , 2)
> >
> >it returns 111111111111111111111111
> >
> >This is correct but i wish to keep the leading zeros for bit manipulation
> >
> >so i need the result to be ,
> >00000000111111111111111111111111
> >
> >
> >
> You can't do it directly in baseconvert (AFAIK), but you can use
> "format" to add leading 0s
>
> put format("%032s", baseconvert("00FFFFFF", 16, 2))
>     gives
> 00000000111111111111111111111111
>
> --
> Alex Tweedly       http://www.tweedly.net
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.13.2/170 - Release Date: 15/11/2005
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list