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

Discussion

Enter your comment. Wiki syntax is allowed:
I᠎ X R O L
 
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies