# String.index_of

## 功能

返回指定片段第一次出现的位置。

## 语法

```bt
string.index_of(needle)
```

## 参数

| 参数 | 类型 | 必填 | 默认值 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| needle | Any | 否 | '' | 要查找的片段，调用时会先转为字符串。 |

## 返回值

| 类型 | 说明 |
| ------ | ------ |
| Int | 找到时返回起始字节位置；未找到返回 -1。 |

## 示例

```bt
text = 'hello BT'
result = text.index_of('BT')

// 输出：6
print result
```

## 注意事项

- 返回值来自 Rust 字符串查找结果，位置按 UTF-8 字节偏移计算。
