Warning
You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.
STRPOS()
Syntax:
strpos!(<string pointer haystack>, <string pointer needle>)
The STRPOS()
function searches for the string needle in the string haystack. If needle is found, the function returns the position of its first occurrence within haystack. If needle is not found, the function returns 255.
Important note: if needle or haystack are invalid strings, the function returns an undefined number or hangs execution. A string is considered to be invalid if it contains more than 255 consecutive bytes without a terminator (null byte). The longest valid string contains 255 bytes plus a null byte.
Example:
a$ = "xc-basic is cool" b$ = "basic" print strpos!(a$, b$) -- rem the above outputs 3