> ## 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.

# bload

> `bload`函数用于将字符串数据按照特定的编码规则转换为字节序列，支持自定义的编码基数、对齐、前缀以及步进参数

## 函数原型

1. **函数调用：**
   `func bload(data string, base int, align int, prefix string, step int) []byte`

2. **字符串实例方法调用：**
   `func (data string) bload(base int, align int, prefix string, step int) []byte`

### 参数介绍

| 参数名称 | 参数介绍 |
| - | - |
| data | 待转换的字符串数据。 |
| base | 数字的基数，定义了字符转换为数字时使用的基数，有效范围是2到36。 |
| align | 对齐参数，用于调整数据处理中的某些对齐方式，影响数据的处理过程。 |
| prefix | 在每次处理的数据块前添加的前缀字符串，可以用于格式化输出。 |
| step | 步进，控制每隔多少字符进行一次处理，与`prefix`共同作用以分段格式化数据。 |

## 举例

| 输入示例 | 调用语句 | 输出结果 |
| - | - | - |
| `"\x00\x01\x02\x03\x04\x0a"` | `bload(r"\x00\x01\x02\x03\x04\x0a", 16, 2, "\\x", 1)` | `[0, 1, 2, 3, 4, 10]` |
| `"23"` | `string(23).bload(10, 2, "", 0)` | `[23]` |
| 使用 `format` 函数的输出 `'01234'` | `'01234'.format(2, '0', "\\x", 1).bload(16, 2, "\\x", 1)` | `[0, 1, 2, 3, 4]` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.