csharp String to Binary
public static string ConvertToBinary(string text) { StringBuilder s = new StringBuilder(); foreach (string letter in text.Select(c => Convert.ToString(c, 2))) { s.Append(letter); } return s.ToString(); } Console.WriteLine(ConvertToBinary("Hello World")); //returns: //1001000110010111011001101100110111110000010101111101111111001011011001100100
Converts a String to the Binary equivalent. Needs testing and confirming - as online conversion tools say that the result is malformed.
Updated: Tuesday 12th October 2010, 10:24am
There are 0 comments
Comments are currently closed.