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

# decToHex

> `decToHex`函数用于将整数值从十进制转换为十六进制表示

## 函数原型

`func decToHex(n int) string`

### 参数介绍

| 参数名称 | 参数介绍       |
| ---- | ---------- |
| n    | 待转换的十进制整数。 |

### 返回值

| 类型     | 说明                |
| ------ | ----------------- |
| string | 十进制整数转换后的十六进制字符串。 |

## 举例

下表展示了 `decToHex` 函数如何将不同的十进制整数转换为十六进制字符串：

| 十进制输入 | 调用语句            | 十六进制输出 |
| ----- | --------------- | ------ |
| `32`  | `decToHex(32)`  | `"20"` |
| `255` | `decToHex(255)` | `"ff"` |
| `11`  | `decToHex(11)`  | `"b"`  |
