Find

From OxeyeWiki

Revision as of 22:49, 8 March 2009 by Jeb (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Daisymoon GUI Lib

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
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox