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)))

	return s.ToString();

Console.WriteLine(ConvertToBinary("Hello World"));
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, 05:07am

There are 0 comments

Leave a comment of your own

Comments are currently closed.