Find
From OxeyeWiki
WChar:find(value[, startPosition]) | ||
Looks for the first occurrence of 'value' in the string object. | ||
Parameter | Expected Type | Description |
value | A WChar | The string value to look for, case sensitive. |
startPosition | Optional integer | Character position to start the search at. Defaults to 1 (beginning of the string) if omitted. |
Returns | ||
If the value can't be found in the string object, the method will return nil. Otherwise, it will return two integer values that tell the first position in the string where the match was found, and the last position of the match. |
Example
local text = WChar("abcde") text:find(WChar("a")) -- returns 1,1 text:find(WChar("ab")) -- returns 1,2 text:find(WChar("de")) -- returns 4,5 text:find(WChar("a"), 2) -- returns nil,nil