ListIndexAfter

Typeoperator
DictionaryLCB
LibraryLiveCode Builder
Syntax
the ( first | last ) index of <Needle> after <After> in <Haystack>
Associationscom.livecode.list
Summary

Find the first or last occurrence of Needle within the tail of Haystack Target:An expression which evaluates to a list.

Parameters
NameTypeDescription
Needle

An expression which evaluates to any value.

After

An expression which evaluates to a valid index in Target.

Example
variable tVar as List
variable tOffset as Number
put ["a", "b", "c", "d", "b"]
put the index of "b" after 1 in tVar into tOffset
--tOffset contains 2

put the last index of "b" after 2 in tVar into tOffset
--tOffset contains 5
Values
NameTypeDescription
return

Returns the index in Haystack relative to After.

Description

Use the index of‰?? after to find where particular elements occur within a list. Starting from but not including the position After, Haystack is scanned for an element that is equal to Needle, and the position of the element found is returned. If no element of Haystack is equal to Needle, the return value is 0.

Tagslists