> For the complete documentation index, see [llms.txt](https://docs.cheddar.vihan.org/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cheddar.vihan.org/docs/standard-library/string/index.md).

# Index

| type   | returns  |
| ------ | -------- |
| method | `number` |

## Arguments

| name   | type   | description                 |
| ------ | ------ | --------------------------- |
| needle | string | The substring to search for |

## Explanation

Returns the index of the start of the `substring` in the given string. Returns `-1` if not found.

## Examples

```swift
"Hello! Hi!".index("Hi") == 7
"Goats :D".index("Hi") == -1
```
