Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6860269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:23:16+00:00 2026-05-27T02:23:16+00:00

static List<int> ConvertTextToBinary(int number, int Base) { List<int> list = new List<int>(); while (number!=0)

  • 0
static List<int> ConvertTextToBinary(int number, int Base)
{
    List<int> list = new List<int>();
    while (number!=0)
    {
        list.Add(number % Base);
        number = number / Base;
    }
    list.Reverse();
    return list;
}



static void Main(string[] args)
{

   string s = "stackoverflow";
   int counter=0;
   while (counter!=s.Length)
   {
       int[] a = ConvertTextToBinary(s[counter], 2).ToArray();
       for (int i = 0; i < a.Length; i++)
       {
           Console.Write(a[i]);
       }
       Console.Write("\n");
       counter++;
   }
}

I wrote a method to convert string to binary, its working fine. But now I want to convert binary to string eg: 1101000 is equal to h.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:23:17+00:00Added an answer on May 27, 2026 at 2:23 am
    static string ConvertBinaryToText(List<List<int>> seq){
        return new String(seq.Select(s => (char)s.Aggregate( (a,b) => a*2+b )).ToArray());
    }
    
    static void Main(){
       string s = "stackoverflow";
       var binary = new List<List<int>>();
       for(var counter=0; counter!=s.Length; counter++){
           List<int> a = ConvertTextToBinary(s[counter], 2);
           binary.Add(a);
           foreach(var bit in a){
               Console.Write(bit);
           }
           Console.Write("\n");
       }
       string str = ConvertBinaryToText(binary);
       Console.WriteLine(str);//stackoverflow
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public static void main(String[] args) { List<? extends Object> mylist = new ArrayList<Object>(); mylist.add(Java);
public class Main { public static void main(String args[]) { List list = new
public static List<double[]> pc = new LinkedList(); public void fillTable1() { int index =
import java.util.Arrays; import java.util.*; class Main { public static void main(String[] args) { }
public static List<Vertex<Integer>> petersenGraph() { List<Vertex<Integer>> v = new ArrayList<Vertex<Integer>>(); for (int i =
i have the following code: public static void Serialize() { List<string> dirs = FileHelper.GetFilesRecursive(fileDirectoryPath);
I have a condition like this List<String> mainList = new ArrayList<String>(); for(int i=0; i<3;
For example, I have a List List<int> list = new List<int>(); list.Add(1); list.Add(5); list.Add(7);
I have this structure: static Dictionary<int, Dictionary<int, string>> tasks = new Dictionary<int, Dictionary<int, string>>();
add index code: public class IndexManage { public static void AddIndex(List<QuestionItem> itemList) { Analyzer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.