# url.build

## 功能

从对象配置构建 URL 字符串。

## 语法

```bt
url(config).build()
url('').build(config)
```

## 参数

| 参数 | 类型 | 必填 | 默认值 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| config | Object | 否 | 构造 url 时传入的对象 | URL 配置对象。 |

## 返回值

| 类型 | 说明 |
| ------ | ------ |
| String | 构建后的 URL。 |

## 代码示例

```bt
result = url({scheme: 'https', host: 'btlang.org', path: '/docs', query: {q: 'BT Lang'}}).build()

// 输出：https://btlang.org/docs?q=BT%20Lang

print result
```

## 注意事项

- 支持字段：scheme、host、port、path、query、fragment、username、password。
- query 可以是对象或字符串。
