# String.index_of ## Function Returns the position of the first occurrence of the specified fragment. ## Syntax ```bt string.index_of(needle) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | needle | Any | No | '' | The fragment to be found will be converted into a string first when called. | ## Return value | Type | Description | | ------ | ------ | | Int | Returns the starting byte position if found; returns -1 if not found. | ## Example ```bt text = 'hello BT' result = text.index_of('BT') // Output: 6 print result ``` ## Notes - The return value comes from the Rust string lookup result, and the position is calculated as a UTF-8 byte offset.