tuple_insertT_tuple_insertTupleInsertTupleInsert (Operator)

Name

tuple_insertT_tuple_insertTupleInsertTupleInsert — Inserts one or more elements into a tuple at index.

Signature

tuple_insert( : : Tuple, Index, InsertTuple : Extended)

Herror T_tuple_insert(const Htuple Tuple, const Htuple Index, const Htuple InsertTuple, Htuple* Extended)

void TupleInsert(const HTuple& Tuple, const HTuple& Index, const HTuple& InsertTuple, HTuple* Extended)

HTuple HTuple::TupleInsert(const HTuple& Index, const HTuple& InsertTuple) const

static void HOperatorSet.TupleInsert(HTuple tuple, HTuple index, HTuple insertTuple, out HTuple extended)

HTuple HTuple.TupleInsert(HTuple index, HTuple insertTuple)

Description

tuple_inserttuple_insertTupleInsertTupleInsertTupleInsert inserts the elements of the tuple InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple at index into the tuple TupleTupleTupleTupletuple and returns them in the tuple ExtendedExtendedExtendedExtendedextended. In this context IndexIndexIndexIndexindex determines the start index of the elements and InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple the values to insert. Successive values of TupleTupleTupleTupletuple will be positioned after the inserted values of InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple. The parameter IndexIndexIndexIndexindex must contain a single integer value (any floating point number must represent an integer value without fraction). Indices of tuple elements start at 0. Therefore, the first tuple element has got the index 0. If IndexIndexIndexIndexindex contains the length of TupleTupleTupleTupletuple as index, InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple will be appended. The length of the result tuple ExtendedExtendedExtendedExtendedextended is always the sum of the two input tuples TupleTupleTupleTupletuple and InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple. For example, if TupleTupleTupleTupletuple contains the values [0,1,0,1,0,1], the IndexIndexIndexIndexindex contains the value [3] and the InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple contains the values [2,2,2], then the output tuple ExtendedExtendedExtendedExtendedextended will contain the values [0,1,0,2,2,2,1,0,1]. It is allowed to mix strings and numbers in the input tuples TupleTupleTupleTupletuple and InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple.

Exception: Empty input tuples

If any of the input tuples is empty, an exception is raised.

Execution Information

Parameters

TupleTupleTupleTupletuple (input_control)  tuple(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Input tuple.

IndexIndexIndexIndexindex (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Start index of elements to be inserted.

InsertTupleInsertTupleInsertTupleInsertTupleinsertTuple (input_control)  tuple(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Element(s) to insert at index.

ExtendedExtendedExtendedExtendedextended (output_control)  tuple-array HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Tuple with inserted elements.

Alternatives

tuple_concattuple_concatTupleConcatTupleConcatTupleConcat, tuple_replacetuple_replaceTupleReplaceTupleReplaceTupleReplace, tuple_gen_consttuple_gen_constTupleGenConstTupleGenConstTupleGenConst

See also

tuple_removetuple_removeTupleRemoveTupleRemoveTupleRemove

Module

Foundation