将字符串数组转换为字节数组,然后再转换回vb.net

编程入门 行业动态 更新时间:2024-10-24 01:48:25
本文介绍了将字符串数组转换为字节数组,然后再转换回vb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我想知道如何将一维字符串数组转换为字节数组并再次返回。我试过在网上搜索,没有答案是我正在寻找的。我真的很绝望,因为我需要这个代码用于我正在构建的数据库。 谢谢, iProgramit

Hi guys, I am wondering how to convert a 1-dimensional array of string to array of bytes and back again. I have tried searching on the web and no answers are what I am looking for. I am really desperate, as I need this code for a database I am building. Thanks, iProgramit

推荐答案

每个字符串都会转换为字节数组并返回,具体取决于您要使用的编码,因此这是由编码类完成的:msdn.microsoft/en-us/library/ system.text.encoding%28v = vs.110%29.aspx [ ^ ]。 显然,因为字符串总是Unicode字符串,只有在使用代表Unicode UTF的编码时才能保证往返。对于字符串数组,您可以编码字符串之间的边界...您喜欢的任何方式。如果你向我解释你的目的,我会建议更确定的。例如,它可以是XML标记,或其他任何东西。
-SA
Each string is converted to array of bytes and back depending on the encoding you want to use, so this is done by the encoding classes: msdn.microsoft/en-us/library/system.text.encoding%28v=vs.110%29.aspx[^]. Apparently, as strings are always Unicode strings, the round trip is guaranteed in all cases only if you use encodings representing Unicode UTFs. As to the array of strings, you can encode the boundaries between strings… any way you prefer. I would advise something more certain if you explained me your purpose. For example, it could be XML markup, or anything else.
—SA

更多推荐

将字符串数组转换为字节数组,然后再转换回vb.net

本文发布于:2023-10-23 00:09:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519151.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   然后再   转换为   字符串   字节

发布评论

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

>www.elefans.com

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