点击或拖拽改变大小

SoftBasicByteToHexString 方法 (Byte, Char, Int32, String)

字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations

命名空间:  HslCommunication.BasicFramework
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:12.0.0.0 (12.0.0.0)
语法
public static string ByteToHexString(
	byte[] InBytes,
	char segment,
	int newLineCount,
	string format = "{0:X2}"
)

参数

InBytes
类型:SystemByte
字节数组
segment
类型:SystemChar
分割符,如果设置为0,则没有分隔符信息
newLineCount
类型:SystemInt32
每隔指定数量的时候进行换行,如果小于等于0,则不进行分行显示
format (Optional)
类型:SystemString
格式信息,默认为{0:X2}

返回值

类型:String
返回的字符串
示例
ByteToHexString示例
byte[] b1 = new byte[] { 0x13, 0xA6, 0x15, 0x85, 0x5B, 0x05, 0x12, 0x36, 0xF2, 0x27 };

Console.WriteLine( SoftBasic.ByteToHexString( b1 ) );

// 输出 "13A615855B051236F227";
参见