ClassesClassesClassesClasses | | | | Operators

tuple_replaceT_tuple_replaceTupleReplacetuple_replaceTupleReplaceTupleReplace (Operator)


tuple_replaceT_tuple_replaceTupleReplacetuple_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)

Herror 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

void HOperatorSetX.TupleReplace(
[in] VARIANT Tuple, [in] VARIANT Index, [in] VARIANT ReplaceTuple, [out] VARIANT* Replaced)

VARIANT HTupleX.TupleReplace(
[in] VARIANT Tuple, [in] VARIANT Index, [in] VARIANT ReplaceTuple)

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

HTuple HTuple.TupleReplace(HTuple index, HTuple replaceTuple)


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

It is allowed to mix strings and numbers in the input tuples TupleTupleTupleTupleTupletuple and ReplaceTupleReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple.

Exception: Empty input tuples

If either IndexIndexIndexIndexIndexindex or ReplaceTupleReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple is empty and the other is not, an exception is raised. If both are empty, the output tuple ReplacedReplacedReplacedReplacedReplacedreplaced corresponds to the input TupleTupleTupleTupleTupletuple. If both are empty, but the input TupleTupleTupleTupleTupletuple is not, the empty tuple will be extended as described above.

HDevelop In-line Operation

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

Replaced := replace(Tuple, Index, ReplaceTuple)



TupleTupleTupleTupleTupletuple (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*) (Hlong / double / BSTR) (Hlong / double / char*)

Input tuple.

IndexIndexIndexIndexIndexindex (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double) (Hlong / double) (Hlong / double)

Index/Indices of elements to be replaced.

ReplaceTupleReplaceTupleReplaceTupleReplaceTupleReplaceTuplereplaceTuple (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*) (Hlong / double / BSTR) (Hlong / double / char*)

Element(s) to replace.

ReplacedReplacedReplacedReplacedReplacedreplaced (output_control)  number-array HTupleHTupleHTupleVARIANTHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*) (Hlong / double / BSTR) (Hlong / double / char*)

Tuple with replaced elements.


tuple_selecttuple_selectTupleSelecttuple_selectTupleSelectTupleSelect, tuple_first_ntuple_first_nTupleFirstNtuple_first_nTupleFirstNTupleFirstN, tuple_last_ntuple_last_nTupleLastNtuple_last_nTupleLastNTupleLastN, tuple_select_masktuple_select_maskTupleSelectMasktuple_select_maskTupleSelectMaskTupleSelectMask, tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelect, tuple_concattuple_concatTupleConcattuple_concatTupleConcatTupleConcat, tuple_select_ranktuple_select_rankTupleSelectRanktuple_select_rankTupleSelectRankTupleSelectRank

See also

tuple_removetuple_removeTupleRemovetuple_removeTupleRemoveTupleRemove, tuple_inserttuple_insertTupleInserttuple_insertTupleInsertTupleInsert



ClassesClassesClassesClasses | | | | Operators