finditem
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | finditem [2007/02/27 04:57] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | # $EPIC: finditem.txt, | ||
| + | ======Synopsis: | ||
| + | $__finditem__(< | ||
| + | |||
| + | ======Description: | ||
| + | If you remember with [[setitem]], | ||
| + | number, and some stuff. | ||
| + | whose " | ||
| + | if multiple items have the same " | ||
| + | be returned. | ||
| + | |||
| + | To be more precise about it, this function returns a number //N// such that | ||
| + | |||
| + | getitem(// | ||
| + | |||
| + | is true. If multiple items in the array have the same value //string//, | ||
| + | which one is returned is undefined. | ||
| + | first one, and [[finditems]] to get a list of all of them. Check out | ||
| + | [[ifinditem]] to get the index number instead of the item number. | ||
| + | |||
| + | ======Practical: | ||
| + | These functions are useful when you want to see if a particular string is | ||
| + | present in an array. | ||
| + | the general pattern-matching functions. | ||
| + | |||
| + | ======Returns: | ||
| + | < | ||
| + | -2 item not found in array | ||
| + | -1 array does not exist | ||
| + | > -1 | ||
| + | </ | ||
| + | |||
| + | ======Examples: | ||
| + | < | ||
| + | /* contrived sample array */ | ||
| + | $setitem(booya 0 blah) | ||
| + | $setitem(booya 1 foobar) | ||
| + | $setitem(booya 2 blah) | ||
| + | |||
| + | $finditem(booya blah) | ||
| + | $ifinditem(booya blah) returns 1 | ||
| + | $ifindfirst(booya blah) | ||
| + | $finditem(booya Blah) | ||
| + | $finditem(foobar blah) returns -2 | ||
| + | </ | ||
finditem.txt · Last modified: 2007/02/27 04:57 by 127.0.0.1
