06-19-2009 13:38
More Fun, matching the first or last index in a source list, to any of up to 8 possible other single list items.

NOTE: only works for string data types, and you may want to modify the separator to suit your needs (it should be something that WON'T be in any of the strings)

CODE

/*//-- Get First Index in List Source of any of List Test --//*/
integer uMatchLstIdxFwd( list vLstSrc, list vLstTst ){
return ((llParseString2List(
llList2String(
llParseStringKeepNulls(
llDumpList2String( vLstSrc, ";" ),
vLstTst, [] ),
0 ),
(list)";", [] ) != []) + 1) %
((vLstSrc != []) + 1) - 1;
}


CODE

/*//-- Get Last Index in List Source of any of List Test --//*/
integer uMatchLstIdxRev( list vLstSrc, list vLstTst ){
return (vLstSrc != []) -
(llParseString2List(
llList2String(
llParseString2List(
llDumpList2String( vLstSrc, ";" ),
vLstTst, [] ),
-1 ),
(list)";",
[] ) != []) - 1;
}


neither is fully checked for micro optimizations
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -