格式化字符串 [英] Formatting string

查看:123
本文介绍了格式化字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

h

如何将字节数组转换为字符串,以便字符串以十六进制格式显示。任何人都可以帮助


John

h
how can I convert a byte array to string, so that the bytes appear in hex format in the string. Can anyone help

John

推荐答案

嗨约翰,


Normaly Jon回答这个问题,有些日子我没有看到他,我尝试了。


字符串采用unicode格式,dotNet程序为2Bytes。

也许你想要将一个包含扩展ASCII的字节数组转换为

a string?

(这将是unicode 2Bytes)。


在VB中,Chr和ChrW有两个功能,而最后一个是建议使用



Cor
Hi John,

Normaly Jon answers this, I did not see him some days, I try it.

A string is in unicode format, 2Bytes in dotNet programs.

Maybe you do you want to convert an byte array which holds extended ASCII to
a string?
(Which than will be unicode 2Bytes).

In VB there there are two functions for that Chr and ChrW while the last is
advised.

Cor


嗨John,


Normaly Jon回答这个问题,我有几天没见到他,我试试看。


字符串是unicode格式,dotNet程序中的2Bytes。


也许你想要转换一个包含扩展ASCII的字节数组到

a string?

(这将是unicode 2Bytes)。


在VB中有两个函数用于Chr和d ChrW,而最后一个是

建议。


Cor
Hi John,

Normaly Jon answers this, I did not see him some days, I try it.

A string is in unicode format, 2Bytes in dotNet programs.

Maybe you do you want to convert an byte array which holds extended ASCII to
a string?
(Which than will be unicode 2Bytes).

In VB there there are two functions for that Chr and ChrW while the last is
advised.

Cor


byte [] bs = { 0xef,0xee,0xaa}

foreach(bs中的字节b

System.Console.WriteLine(b.ToString(" x"))

Tu-Thac
www.ongtech.co


----- John Sturm写道:----


h

如何转换字节数组?字符串,以便字符串以十六进制格式显示在字符串中。任何人都可以帮助


John
byte[] bs = {0xef, 0xee, 0xaa}
foreach (byte b in bs

System.Console.WriteLine(b.ToString("x"))
Tu-Thac
www.ongtech.co

----- John Sturm wrote: ----

h
how can I convert a byte array to string, so that the bytes appear in hex format in the string. Can anyone help

John


这篇关于格式化字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆