forked from solstice/solstice
21 lines
522 B
Markdown
21 lines
522 B
Markdown
|
|
# string_FindLast
|
||
|
|
Look for the last occurence of `needle` in `haystack` and return its index in the string. If it isn't found, return -1.
|
||
|
|
|
||
|
|
## Arguments
|
||
|
|
- haystack (string): the string to search.
|
||
|
|
- needle (string): the substring to look for.
|
||
|
|
|
||
|
|
## Returns
|
||
|
|
index (int): the index of the last occurence of `needle` in `haystack`. If it isn't found, return -1.
|
||
|
|
|
||
|
|
## Example
|
||
|
|
### Ground
|
||
|
|
```python
|
||
|
|
call !string_FindLast "abcabcabc" "b" &index
|
||
|
|
println $index # 7
|
||
|
|
```
|
||
|
|
|
||
|
|
### Solstice
|
||
|
|
```c
|
||
|
|
puts string_FindLast("abcabcabc", "b") // 7
|
||
|
|
```
|