Click here to Skip to main content
16,009,255 members
Home / Discussions / C#
   

C#

 
GeneralRemoving HTML-tags from a string Pin
anderslundsgard23-May-05 18:08
anderslundsgard23-May-05 18:08 
GeneralRe: Removing HTML-tags from a string Pin
Serdar YILMAZ23-May-05 21:27
Serdar YILMAZ23-May-05 21:27 
GeneralRe: Removing HTML-tags from a string Pin
anderslundsgard23-May-05 22:27
anderslundsgard23-May-05 22:27 
GeneralRe: Removing HTML-tags from a string Pin
eggie524-May-05 12:53
eggie524-May-05 12:53 
Questionlgo4net not found...? Reference: Copy Local solved the problem...? Pin
devvvy23-May-05 17:53
devvvy23-May-05 17:53 
GeneralTell me Default Encoding technique Pin
shumyla198323-May-05 17:02
shumyla198323-May-05 17:02 
GeneralString of Bits to Byte[ ] Conversion Pin
gordsh23-May-05 15:59
gordsh23-May-05 15:59 
GeneralRe: String of Bits to Byte[ ] Conversion Pin
S. Senthil Kumar23-May-05 18:11
S. Senthil Kumar23-May-05 18:11 
The simplest way is take 8 bits at a time and convert them from binary to decimal. Something like
private byte[] GetByteArray(string binaryText)
{
   byte []arr = new byte[binaryText.Length / 8]; // assuming 8 bits = 1 byte

   for (int i = 0; i<binaryText.Length; i+=8)
   {
       string currentByte = binaryText.Substring(i, 8);
       arr[i%8] = Convert.ToByte(currentByte, 2); // Binary to decimal.
   }

   return arr;
}

This does assume that the binary text's length will be a multiple of 8, if not, you have to pad the first byte with 0s.

Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
GeneralRe: String of Bits to Byte[ ] Conversion Pin
Robert Rohde23-May-05 20:33
Robert Rohde23-May-05 20:33 
GeneralRe: String of Bits to Byte[ ] Conversion Pin
gordsh24-May-05 15:51
gordsh24-May-05 15:51 
GeneralShow hidden forms Pin
methodincharge23-May-05 13:30
methodincharge23-May-05 13:30 
GeneralRe: Show hidden forms Pin
Rob Tomson23-May-05 13:42
Rob Tomson23-May-05 13:42 
GeneralRe: Show hidden forms Pin
methodincharge23-May-05 13:56
methodincharge23-May-05 13:56 
GeneralRe: Show hidden forms Pin
Skynyrd24-May-05 6:55
Skynyrd24-May-05 6:55 
GeneralRe: Show hidden forms Pin
methodincharge24-May-05 7:38
methodincharge24-May-05 7:38 
GeneralRe: Show hidden forms Pin
Skynyrd24-May-05 21:41
Skynyrd24-May-05 21:41 
GeneralRe: Show hidden forms Pin
methodincharge25-May-05 2:02
methodincharge25-May-05 2:02 
GeneralRe: Show hidden forms Pin
methodincharge25-May-05 14:03
methodincharge25-May-05 14:03 
GeneralShow xml node in text box without losing formatting Pin
PrachiB23-May-05 12:41
PrachiB23-May-05 12:41 
GeneralRe: Show xml node in text box without losing formatting Pin
DavidNohejl23-May-05 12:58
DavidNohejl23-May-05 12:58 
GeneralRe: Show xml node in text box without losing formatting Pin
PrachiB23-May-05 13:16
PrachiB23-May-05 13:16 
GeneralRe: Show xml node in text box without losing formatting Pin
J4amieC23-May-05 21:42
J4amieC23-May-05 21:42 
GeneralRe: Show xml node in text box without losing formatting Pin
DavidNohejl23-May-05 23:24
DavidNohejl23-May-05 23:24 
GeneralRe: Show xml node in text box without losing formatting Pin
eggie524-May-05 12:58
eggie524-May-05 12:58 
Generaltextbox transparent Pin
Sasuko23-May-05 12:07
Sasuko23-May-05 12:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.