This shows you the differences between two versions of the page.

Link to this comparison view

strpos [2019/05/27 21:57] (current)
neils created
Line 1: Line 1:
 +====== STRPOS() ======
 +  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.
 +  a$ = "xc-basic is cool"
 +  b$ = "basic"
 +  print strpos!(a$, b$)
 +  -- rem the above outputs 3