Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.xray.cool/llms.txt

Use this file to discover all available pages before exploring further.

函数原型

func (b1 bytes) bformat(int, int, string, int) string

参数介绍

参数名称参数介绍
b1待转化的数据
进制要转换的进制
填充位数如果转换后的字符的位数小于该值,则会在前面添加0来进行填充
填充字符在转换后的字符前添加指定字符串,例如\x
填充位置控制第三,四个参数添加的位置
输出输出结果为字符串

举例

待转换数据转换语句输出结果
asdfghjb'asdfghj'.bformat(16,0,'',0)6173646667686a
asdfghjb'asdfghj'.bformat(16,4,'',0)006100730064006600670068006a
asdfghjb'asdfghj'.bformat(16,0,'\\\x',1)\x61\x73\x64\x66\x67\x68\x6a
asdfghjb'asdfghj'.bformat(8, 0, "0", 1)0141016301440146014701500152
\x00\x01\x02\x03\x04\x0ab'\x00\x01\x02\x03\x04\x0a'.bformat(2, 2, "\\b", 1)\b00\b01\b10\b11\b100\b1010