Name
search — Returns position of a substring
Synopsis
integer
search
( |
string
STRING1
, |
|
string
STRING2
) ; |
Parameters
-
string
STRING1
String
-
string
STRING2
Substring
Return
-
integer
OFFSET If substring is not found find returns `nil'.
Description
The search
function searches string for the first occurency of a specified substring (possibly a single character) and returns its starting position.
Returns the first position in STRING1
where the string STRING2
is contained in STRING1
. OFFSET
starts with 0.
Usage
search ("abcdefghi", "efg") -> 4
search ("aaaaa", "z") -> nil