# String.last_index_of ## 功能 返回指定片段最后一次出现的位置。 ## 语法 ```bt string.last_index_of(needle) ``` ## 参数 | 参数 | 类型 | 必填 | 默认值 | 说明 | | ------ | ------ | ------ | ------ | ------ | | needle | Any | 否 | '' | 要查找的片段,调用时会先转为字符串。 | ## 返回值 | 类型 | 说明 | | ------ | ------ | | Int | 找到时返回起始字节位置;未找到返回 -1。 | ## 示例 ```bt text = 'bt-lang-bt' result = text.last_index_of('bt') // 输出:8 print result ``` ## 注意事项 - 返回值按 UTF-8 字节偏移计算。