_find(t: text, p: text, start: int = 0): int

Finds the leftmost occurrence of p in t that begins at or after position start. Returns the index of the first byte of the occurrence, or -1 if none exists.  If the value passed for start is less than 0, 0 is used instead.

_find("vestakit-0.0.tar.gz", ".") == 10
_find("The quick brown fox jumped over the lazy dog", "e", 10) == 24
_find("/vesta/vestasys.org", "_") == -1

_findr(t: text, p: text, start: int = 0): int

Finds the rightmost occurrence of p in t that begins at or after position start. Returns the index of the first byte of the occurrence, or -1 if none exists.  If the value passed for start is less than 0, 0 is used instead.

_findr("vestakit-0.0.tar.gz", ".") == 16
_findr("Do you recall those days of Sahara?", "a") == 33
_findr("The rain in Spain falls mainly on the plain.", "s", 24) == -1

Kenneth C. Schalk <ken@xorian.net> / Primitive Functions / Vesta SDL Programmer's Reference