DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 23 Aug 2007 08:14:06 -0700,    posted on: microsoft.public.dotnet.languages.csharp        back       

Thread Index
  1    Dave
          2    Nicholas Paldino [.NET/C# MVP]
          3    Ignacio Machin \( .NET/ C# MVP \) machin TA laceupsolutions.com


Conver byte to string of 1's and 0's   
I receive input in a byte which gives a value of 0-255. Is there an easy way 
to convert this to a string. The string constiting of 1's and 0's. This is 
necessay because I'm looking for a certain pattern of 12 1's and 0's in a 
sting of 300 bits long. The pattern can be anywhere and doesn't start at 
every fourth bit or any particular position.
Date:Thu, 23 Aug 2007 08:14:06 -0700   Author:  

Re: Conver byte to string of 1's and 0's   
Dave,

    You can call the static ToString method on the Convert class, passing 
the byte, and 2 as the toBase parameter, and it will give you the byte in 
base-2 representation.

    Of course, if you are looking for a specific pattern, you could just use 
a bitmask, and perform shift operations, applying the bitmask every step of 
the way.


-- 
          - Nicholas Paldino [.NET/C# MVP]
          - mvp@spam.guard.caspershouse.com

"Dave"  wrote in message 
news:2DFC236C-82B5-49E2-B8D3-390A95933F67@microsoft.com...

>I receive input in a byte which gives a value of 0-255. Is there an easy 
>way
> to convert this to a string. The string constiting of 1's and 0's. This is
> necessay because I'm looking for a certain pattern of 12 1's and 0's in a
> sting of 300 bits long. The pattern can be anywhere and doesn't start at
> every fourth bit or any particular position. 
Date:Thu, 23 Aug 2007 11:26:35 -0400   Author:  

Re: Conver byte to string of 1's and 0's   
Hi,

In the worst case escenario this is extremely simple to do.

Of course, you have Convert.ToString( byte, int) :)

"Dave"  wrote in message 
news:2DFC236C-82B5-49E2-B8D3-390A95933F67@microsoft.com...

>I receive input in a byte which gives a value of 0-255. Is there an easy 
>way
> to convert this to a string. The string constiting of 1's and 0's. This is
> necessay because I'm looking for a certain pattern of 12 1's and 0's in a
> sting of 300 bits long. The pattern can be anywhere and doesn't start at
> every fourth bit or any particular position. 
Date:Thu, 23 Aug 2007 11:23:08 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us