二进制字符串ASCII文本字符串

编程入门 行业动态 更新时间:2024-10-24 06:32:10
本文介绍了二进制字符串ASCII文本字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述   

可能重复:结果  Binary为了对应的ASCII字符串转换

我之前发布了slimier的问题,但没有得到一个正确的答案。

我的问题是,我有一个二进制字符串作为

00100000011101110110000101101110011101000010000001110100011011110010000001100100011011110111

这需要即时通讯转换为普通的ASCII字符串文本

我用 BinaryReader 和阅读并设有code System.Text.ASCIIEncoding.ASCII ,但即时得到同样 0101010 字符串

字节[]字节组= b.ReadBytes((int)的长度);    System.Text.Encoding encEn codeR = System.Text.ASCIIEncoding.ASCII;    字符串BB = encEn coder.GetString(ByteArray的);

任何帮助将不胜感激!

解决方案

首先转换二进制字符串转换为字节[] 使用How我可以带code 1和0运输的字符串?

接下来使用 Convert.ToBase64String 方法得到实际 System.String

Possible Duplicate: Binary To Corresponding ASCII String Conversion

I posted a slimier question before but didn't got a correct answer..

my problem is i have a binary string as

00100000011101110110000101101110011101000010000001110100011011110010000001100100011011110111

Which im required to convert to "Normal ASCII String Text"

I used BinaryReader and read and encode System.Text.ASCIIEncoding.ASCII but im getting the same 0101010 string

byte[] bytearray = b.ReadBytes((int)length); System.Text.Encoding encEncoder = System.Text.ASCIIEncoding.ASCII; string bb = encEncoder.GetString(bytearray);

any help will be grateful !

解决方案

first translate the binary string into a byte[] using How could I encode a string of 1s and 0s for transport?

next use the Convert.ToBase64String method to get the actual System.String

更多推荐

二进制字符串ASCII文本字符串

本文发布于:2023-11-30 11:37:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649829.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   文本   ASCII

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!