tuple_replaceT_tuple_replaceTupleReplaceTupleReplace (Operator)


tuple_replaceT_tuple_replaceTupleReplaceTupleReplace — Replaces one or more elements of a tuple.


tuple_replace( : : Tuple, Index, ReplaceTuple : Replaced)

Herror T_tuple_replace(const Htuple Tuple, const Htuple Index, const Htuple ReplaceTuple, Htuple* Replaced)

void TupleReplace(const HTuple& Tuple, const HTuple& Index, const HTuple& ReplaceTuple, HTuple* Replaced)

HTuple HTuple::TupleReplace(const HTuple& Index, const HTuple& ReplaceTuple) const

static void HOperatorSet.TupleReplace(HTuple tuple, HTuple index, HTuple replaceTuple, out HTuple replaced)

HTuple HTuple.TupleReplace(HTuple index, HTuple replaceTuple)


tuple_replacetuple_replaceTupleReplaceTupleReplaceTupleReplace replaces one or more elements of the input tuple TupleTupleTupleTupletuple and returns them with ReplacedReplacedReplacedReplacedreplaced. At this, IndexIndexIndexIndexindex determines the indices of the elements and ReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple the corresponding values to replace. The parameter IndexIndexIndexIndexindex must contain one or more integer values (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 ReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple contains only one value, this value will be replaced at all indices of IndexIndexIndexIndexindex. If a value of IndexIndexIndexIndexindex is greater than the length of the input tuple TupleTupleTupleTupletuple, ReplacedReplacedReplacedReplacedreplaced will be extended accordingly and initialized with zeros. For example, if TupleTupleTupleTupletuple contains [1], IndexIndexIndexIndexindex contains the values [2,4], and ReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple contains the values [3,5], ReplacedReplacedReplacedReplacedreplaced will be [1,0,3,0,5].

It is allowed to mix strings and numbers in the input tuples TupleTupleTupleTupletuple and ReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple.

Exception: Empty input tuples

If either IndexIndexIndexIndexindex or ReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple is empty and the other is not, an exception is raised. If both are empty, the output tuple ReplacedReplacedReplacedReplacedreplaced corresponds to the input TupleTupleTupleTupletuple. If both are empty, but the input TupleTupleTupleTupletuple is not, the empty tuple will be extended as described above.

HDevelop In-line Operation

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

Replaced := replace(Tuple, Index, ReplaceTuple)

Execution Information


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(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index/Indices of elements to be replaced.

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

Element(s) to replace.

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

Tuple with replaced elements.


tuple_selecttuple_selectTupleSelectTupleSelectTupleSelect, tuple_first_ntuple_first_nTupleFirstNTupleFirstNTupleFirstN, tuple_last_ntuple_last_nTupleLastNTupleLastNTupleLastN, tuple_select_masktuple_select_maskTupleSelectMaskTupleSelectMaskTupleSelectMask, tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelectTupleStrBitSelect, tuple_concattuple_concatTupleConcatTupleConcatTupleConcat, tuple_select_ranktuple_select_rankTupleSelectRankTupleSelectRankTupleSelectRank

See also

tuple_removetuple_removeTupleRemoveTupleRemoveTupleRemove, tuple_inserttuple_insertTupleInsertTupleInsertTupleInsert