tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangetuple_select_range (算子)

名称

tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangetuple_select_range — 选择元组的几个元素。

签名

tuple_select_range( : : Tuple, Leftindex, Rightindex : Selected)

Herror tuple_select_range(const Hlong Tuple, const Hlong Leftindex, const Hlong Rightindex, Hlong* Selected)

Herror T_tuple_select_range(const Htuple Tuple, const Htuple Leftindex, const Htuple Rightindex, Htuple* Selected)

void TupleSelectRange(const HTuple& Tuple, const HTuple& Leftindex, const HTuple& Rightindex, HTuple* Selected)

HTuple HTuple::TupleSelectRange(const HTuple& Leftindex, const HTuple& Rightindex) const

static void HOperatorSet.TupleSelectRange(HTuple tuple, HTuple leftindex, HTuple rightindex, out HTuple selected)

HTuple HTuple.TupleSelectRange(HTuple leftindex, HTuple rightindex)

def tuple_select_range(tuple: MaybeSequence[Union[float, int, str]], leftindex: MaybeSequence[int], rightindex: MaybeSequence[int]) -> Sequence[Union[float, int, str]]

def tuple_select_range_s(tuple: MaybeSequence[Union[float, int, str]], leftindex: MaybeSequence[int], rightindex: MaybeSequence[int]) -> Union[float, int, str]

描述

tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangeTupleSelectRangetuple_select_range selects several consecutive elements of the input tuple TupleTupleTupleTupletupletuple and returns them with SelectedSelectedSelectedSelectedselectedselected. At this, LeftindexLeftindexLeftindexLeftindexleftindexleftindex determines the index of the first element and RightindexRightindexRightindexRightindexrightindexrightindex determines the index of the last element to select. Thus, both parameters LeftindexLeftindexLeftindexLeftindexleftindexleftindex and RightindexRightindexRightindexRightindexrightindexrightindex must contain a single integer value (any floating point number must represent an integer value without fraction). Indices of tuple elements start at 0, that means, the first tuple element has got the index 0. The result tuple SelectedSelectedSelectedSelectedselectedselected contains every element from the tuple TupleTupleTupleTupletupletuple that has got an index between LeftindexLeftindexLeftindexLeftindexleftindexleftindex and RightindexRightindexRightindexRightindexrightindexrightindex (including the elements at position LeftindexLeftindexLeftindexLeftindexleftindexleftindex and RightindexRightindexRightindexRightindexrightindexrightindex). If the indices are equal, only one element is selected. In addition, it is possible that the right index is LeftindexLeftindexLeftindexLeftindexleftindexleftindex - 1. In this case and if the left or right index are valid an empty tuple is returned. Hence, the index RightindexRightindexRightindexRightindexrightindexrightindex must be greater or equal to LeftindexLeftindexLeftindexLeftindexleftindexleftindex - 1.

例外:空输入元组

If LeftindexLeftindexLeftindexLeftindexleftindexleftindex and RightindexRightindexRightindexRightindexrightindexrightindex are empty tuples, the operator returns an empty tuple. If only one of those parameters or TupleTupleTupleTupletupletuple is an empty tuple, an exception is raised.

HDevelop 内联操作

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

Selected := Tuple[Leftindex:Rightindex]

执行信息

参数

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

Input tuple.

LeftindexLeftindexLeftindexLeftindexleftindexleftindex (输入控制)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index of first element to select.

RightindexRightindexRightindexRightindexrightindexrightindex (输入控制)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index of last element to select.

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

Selected tuple elements.

替代

tuple_selecttuple_selectTupleSelectTupleSelectTupleSelecttuple_select, tuple_first_ntuple_first_nTupleFirstNTupleFirstNTupleFirstNtuple_first_n, tuple_last_ntuple_last_nTupleLastNTupleLastNTupleLastNtuple_last_n, tuple_select_masktuple_select_maskTupleSelectMaskTupleSelectMaskTupleSelectMasktuple_select_mask, tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select, tuple_concattuple_concatTupleConcatTupleConcatTupleConcattuple_concat, tuple_select_ranktuple_select_rankTupleSelectRankTupleSelectRankTupleSelectRanktuple_select_rank

另见

tuple_removetuple_removeTupleRemoveTupleRemoveTupleRemovetuple_remove

模块

基础