tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangetuple_select_range (Operator)

Name

tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangetuple_select_range — Auswählen mehrerer Elemente eines Tupels.

Signatur

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]

Beschreibung

tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangeTupleSelectRangetuple_select_range wählt mehrere aufeinanderfolgende Elemente eines Tupels TupleTupleTupleTupletupletuple aus und liefert sie über den Parameter SelectedSelectedSelectedSelectedselectedselected zurück. Der Parameter LeftindexLeftindexLeftindexLeftindexleftindexleftindex gibt hierbei den Index des ersten auszuwählenden Tupelelements und der Parameter RightindexRightindexRightindexRightindexrightindexrightindex den Index des letzten auszuwählenden Tupelelements an. Folgerichtig müssen beide Parameter LeftindexLeftindexLeftindexLeftindexleftindexleftindex und RightindexRightindexRightindexRightindexrightindexrightindex eine ganze Zahl beinhalten (falls sie eine Gleitkommazahl enthalten, so muss diese eine ganze Zahl repräsentieren; alle Nachkommastellen der Zahl müssen also 0 sein). Der Index eines Tupelelements wird beginnend mit 0 gezählt, das heißt, das erste Tupelelement wird über den Index 0 ausgewählt. Das Ergebnistupel SelectedSelectedSelectedSelectedselectedselected enthält dann alle Elemente von TupleTupleTupleTupletupletuple, die zwischen den Positionen LeftindexLeftindexLeftindexLeftindexleftindexleftindex und RightindexRightindexRightindexRightindexrightindexrightindex stehen (inklusive der Elemente mit dem Index LeftindexLeftindexLeftindexLeftindexleftindexleftindex und RightindexRightindexRightindexRightindexrightindexrightindex). Sind beide Indices gleich groß, so wird ein einzelnes Element ausgewählt. Der Parameter RightindexRightindexRightindexRightindexrightindexrightindex kann darüber hinaus auch um 1 kleiner sein, als LeftindexLeftindexLeftindexLeftindexleftindexleftindex. In diesem Fall wird, wenn LeftindexLeftindexLeftindexLeftindexleftindexleftindex oder RightindexRightindexRightindexRightindexrightindexrightindex ein gültiger Index sind, ein leeres Tupel zurück geliefert. Der Index in RightindexRightindexRightindexRightindexrightindexrightindex muss somit immer größer oder gleich LeftindexLeftindexLeftindexLeftindexleftindexleftindex - 1 sein.

Sonderfall: Leere Eingabetupel

Falls LeftindexLeftindexLeftindexLeftindexleftindexleftindex und RightindexRightindexRightindexRightindexrightindexrightindex leere Tupel sind, wird ein leerer Tupel zurückgegeben. Wenn nur einer dieser beiden Parameter oder TupleTupleTupleTupletupletuple ein leeres Tupel ist, wird eine Fehlermeldung angezeigt.

HDevelop Inline-Operation

HDevelop unterstützt eine Inline-Operation für tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangeTupleSelectRangetuple_select_range, die innerhalb eines Ausdrucks in der folgenden Syntax verwendet werden kann:

Selected := Tuple[Leftindex:Rightindex]

Ausführungsinformationen

Parameter

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

Eingabetupel.

LeftindexLeftindexLeftindexLeftindexleftindexleftindex (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index des ersten auszuwählenden Elements.

RightindexRightindexRightindexRightindexrightindexrightindex (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index des letzten auszuwählenden Elements.

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

Ausgewählte Tupelelemente.

Alternativen

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

Siehe auch

tuple_removetuple_removeTupleRemoveTupleRemoveTupleRemovetuple_remove

Modul

Foundation