Tweak String.indexOf(_,_) a bit.
- Simplify the arithmetic a little in wrenStringFind(). - Allow the start to be negative. - Even more tests. - Docs.
This commit is contained in:
@@ -120,6 +120,15 @@ Returns the index of the first byte matching `search` in the string or `-1` if
|
||||
|
||||
It is a runtime error if `search` is not a string.
|
||||
|
||||
### **indexOf**(search, start)
|
||||
|
||||
Returns the index of the first byte matching `search` in the string or `-1` if
|
||||
`search` was not found, starting a byte offset `start`. The start can be
|
||||
negative to count backwards from the end of the string.
|
||||
|
||||
It is a runtime error if `search` is not a string or `start` is not an integer
|
||||
index within the string's byte length.
|
||||
|
||||
### **iterate**(iterator), **iteratorValue**(iterator)
|
||||
|
||||
Implements the [iterator protocol](../../control-flow.html#the-iterator-protocol)
|
||||
|
||||
Reference in New Issue
Block a user