tuple_insertT_tuple_insertTupleInsertTupleInserttuple_insert (算子)

名称

tuple_insertT_tuple_insertTupleInsertTupleInserttuple_insert — 在索引处将一个或多个元素插入到元组中。

签名

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)

def tuple_insert(tuple: MaybeSequence[Union[float, int, str]], index: int, insert_tuple: MaybeSequence[Union[float, int, str]]) -> Sequence[Union[float, int, str]]

描述

tuple_inserttuple_insertTupleInsertTupleInsertTupleInserttuple_insert inserts the elements of the tuple InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple at index into the tuple TupleTupleTupleTupletupletuple and returns them in the tuple ExtendedExtendedExtendedExtendedextendedextended. In this context IndexIndexIndexIndexindexindex determines the start index of the elements and InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple the values to insert. Successive values of TupleTupleTupleTupletupletuple will be positioned after the inserted values of InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple. The parameter IndexIndexIndexIndexindexindex 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 IndexIndexIndexIndexindexindex contains the length of TupleTupleTupleTupletupletuple as index, InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple will be appended. The length of the result tuple ExtendedExtendedExtendedExtendedextendedextended is always the sum of the two input tuples TupleTupleTupleTupletupletuple and InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple. For example, if TupleTupleTupleTupletupletuple contains the values [0,1,0,1,0,1], the IndexIndexIndexIndexindexindex contains the value [3] and the InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple contains the values [2,2,2], then the output tuple ExtendedExtendedExtendedExtendedextendedextended 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 TupleTupleTupleTupletupletuple and InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple

例外:空输入元组

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

HDevelop 内联操作

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

Extended := insert(Tuple, Index, InsertTuple)

执行信息

参数

TupleTupleTupleTupletupletuple (输入控制)  tuple(-array) HTupleMaybeSequence[Union[float, int, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Input tuple.

IndexIndexIndexIndexindexindex (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Start index of elements to be inserted.

InsertTupleInsertTupleInsertTupleInsertTupleinsertTupleinsert_tuple (输入控制)  tuple(-array) HTupleMaybeSequence[Union[float, int, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Element(s) to insert at index.

ExtendedExtendedExtendedExtendedextendedextended (输出控制)  tuple-array HTupleSequence[Union[float, int, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Tuple with inserted elements.

替代

tuple_concattuple_concatTupleConcatTupleConcatTupleConcattuple_concat, tuple_replacetuple_replaceTupleReplaceTupleReplaceTupleReplacetuple_replace, tuple_gen_consttuple_gen_constTupleGenConstTupleGenConstTupleGenConsttuple_gen_const

另见

tuple_removetuple_removeTupleRemoveTupleRemoveTupleRemovetuple_remove

模块

基础