tuple_find_lasttuple_find_lastTupleFindLastTupleFindLasttuple_find_last (Operator)

Name

tuple_find_lasttuple_find_lastTupleFindLastTupleFindLasttuple_find_last — Return the index of the last occurrence of a tuple within another tuple.

Signature

tuple_find_last( : : Tuple, ToFind : Index)

Herror tuple_find_last(const Hlong Tuple, const Hlong ToFind, Hlong* Index)

Herror T_tuple_find_last(const Htuple Tuple, const Htuple ToFind, Htuple* Index)

void TupleFindLast(const HTuple& Tuple, const HTuple& ToFind, HTuple* Index)

HTuple HTuple::TupleFindLast(const HTuple& ToFind) const

static void HOperatorSet.TupleFindLast(HTuple tuple, HTuple toFind, out HTuple index)

HTuple HTuple.TupleFindLast(HTuple toFind)

def tuple_find_last(tuple: MaybeSequence[Union[int, float, str]], to_find: MaybeSequence[Union[int, float, str]]) -> int

Description

tuple_find_lasttuple_find_lastTupleFindLastTupleFindLasttuple_find_last searches backward through TupleTupleTupletupletuple for the first occurrence of the values of the second tuple ToFindToFindToFindtoFindto_find and returns the IndexIndexIndexindexindex (in relation to the first input tuple TupleTupleTupletupletuple). For example, if TupleTupleTupletupletuple contains the values [3,4,5,6,1,2,3,4,0] and ToFindToFindToFindtoFindto_find contains the values [3,4], the output IndexIndexIndexindexindex is 6. If the first tuple does not contain the second tuple as a subtuple, tuple_find_lasttuple_find_lastTupleFindLastTupleFindLasttuple_find_last returns -1 in IndexIndexIndexindexindex. It is allowed to mix strings and numbers in the input tuples.

Exception: Empty input tuples

If either or both of the input tuples are empty, the operator returns an empty tuple.

HDevelop In-line Operation

HDevelop provides an in-line operation for tuple_find_lasttuple_find_lastTupleFindLastTupleFindLasttuple_find_last, which can be used in an expression in the following syntax:

Index := find_last(Tuple, ToFind)

Execution Information

Parameters

TupleTupleTupletupletuple (input_control)  tuple(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Input tuple to examine.

ToFindToFindToFindtoFindto_find (input_control)  tuple(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Input tuple with values to find.

IndexIndexIndexindexindex (output_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index of the last occurrence of the values to find.

Alternatives

tuple_findtuple_findTupleFindTupleFindtuple_find, tuple_find_firsttuple_find_firstTupleFindFirstTupleFindFirsttuple_find_first, tuple_sorttuple_sortTupleSortTupleSorttuple_sort, tuple_equal_elemtuple_equal_elemTupleEqualElemTupleEqualElemtuple_equal_elem

Module

Foundation