Operator Reference

tuple_findtuple_findTupleFindTupleFindtuple_find (Operator)

tuple_findtuple_findTupleFindTupleFindtuple_find — Return the indices of all occurrences of a tuple within another tuple.

Signature

tuple_find( : : Tuple, ToFind : Indices)

Herror tuple_find(const Hlong Tuple, const Hlong ToFind, Hlong* Indices)

Herror T_tuple_find(const Htuple Tuple, const Htuple ToFind, Htuple* Indices)

void TupleFind(const HTuple& Tuple, const HTuple& ToFind, HTuple* Indices)

HTuple HTuple::TupleFind(const HTuple& ToFind) const

static void HOperatorSet.TupleFind(HTuple tuple, HTuple toFind, out HTuple indices)

HTuple HTuple.TupleFind(HTuple toFind)

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

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

Description

tuple_findtuple_findTupleFindTupleFindtuple_find searches TupleTupleTupletupletuple sequentially for all occurrences of the values of the second tuple ToFindToFindToFindtoFindto_find and returns the indices in IndicesIndicesIndicesindicesindices (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 tuple IndicesIndicesIndicesindicesindices will contain the values [0,6]. If the first tuple does not contain the second tuple as a subtuple, tuple_findtuple_findTupleFindTupleFindtuple_find returns -1 in IndicesIndicesIndicesindicesindices. 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_findtuple_findTupleFindTupleFindtuple_find, which can be used in an expression in the following syntax:

Indices := find(Tuple, ToFind)

Execution Information

  • Multithreading type: independent (runs in parallel even with exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

TupleTupleTupletupletuple (input_control)  tuple(-array) HTupleMaybeSequence[Union[float, int, 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[float, int, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Input tuple with values to find.

IndicesIndicesIndicesindicesindices (output_control)  integer(-array) HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Indices of the occurrences of the values to find in the tuple to examine.

Alternatives

tuple_find_firsttuple_find_firstTupleFindFirstTupleFindFirsttuple_find_first, tuple_find_lasttuple_find_lastTupleFindLastTupleFindLasttuple_find_last, tuple_sorttuple_sortTupleSortTupleSorttuple_sort, tuple_inversetuple_inverseTupleInverseTupleInversetuple_inverse, tuple_equal_elemtuple_equal_elemTupleEqualElemTupleEqualElemtuple_equal_elem

Module

Foundation