Skip to content

tuple_find_firstTupleFindFirstTupleFindFirsttuple_find_firsttuple_find_first🔗

Short description🔗

tuple_find_firstTupleFindFirstTupleFindFirsttuple_find_firsttuple_find_first — Return the index of the first occurrence of a tuple within another tuple.

Signature🔗

tuple_find_first( tuple Tuple, tuple ToFind, out integer Index )void TupleFindFirst( const HTuple& Tuple, const HTuple& ToFind, HTuple* Index )static void HOperatorSet.TupleFindFirst( HTuple tuple, HTuple toFind, out HTuple index )def tuple_find_first( tuple: MaybeSequence[Union[int, float, str]], to_find: MaybeSequence[Union[int, float, str]] ) -> int

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

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

HTuple HTuple::TupleFindFirst( const HTuple& ToFind ) const

HTuple HTuple.TupleFindFirst( HTuple toFind )

Description🔗

tuple_find_firstTupleFindFirst searches forward through Tupletupletuple for the first occurrence of the values of the second tuple ToFindtoFindto_find and returns the Indexindexindex (in relation to the first input tuple Tupletupletuple). For example, if Tupletupletuple contains the values [3,4,5,6,1,2,3,4,0] and ToFindtoFindto_find contains the values [3,4], the output Indexindexindex is 0. If the first tuple does not contain the second tuple as a subtuple, tuple_find_firstTupleFindFirst returns -1 in Indexindexindex. 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_firstTupleFindFirst, which can be used in an expression in the following syntax:

Index := find_first(Tuple, ToFind)

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Tupletupletuple (input_control) tuple(-array) → (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)MaybeSequence[Union[int, float, str]]Htuple (Hlong / double / char*)

Input tuple to examine.

ToFindtoFindto_find (input_control) tuple(-array) → (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)MaybeSequence[Union[int, float, str]]Htuple (Hlong / double / char*)

Input tuple with values to find.

Indexindexindex (output_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Index of the first occurrence of the values to find.

Combinations with other operators🔗

Combinations

Alternatives

tuple_findTupleFind, tuple_find_lastTupleFindLast, tuple_sortTupleSort, tuple_equal_elemTupleEqualElem

Module🔗

Foundation