tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select (Operator)

Name

tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select — Select single character or bit from a tuple.

Signature

tuple_str_bit_select( : : Tuple, Index : Selected)

Herror tuple_str_bit_select(const char* Tuple, const Hlong Index, char* Selected)

Herror T_tuple_str_bit_select(const Htuple Tuple, const Htuple Index, Htuple* Selected)

void TupleStrBitSelect(const HTuple& Tuple, const HTuple& Index, HTuple* Selected)

HTuple HTuple::TupleStrBitSelect(const HTuple& Index) const

static void HOperatorSet.TupleStrBitSelect(HTuple tuple, HTuple index, out HTuple selected)

HTuple HTuple.TupleStrBitSelect(HTuple index)

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

def tuple_str_bit_select_s(tuple: MaybeSequence[Union[str, int]], index: int) -> Union[str, int]

Description

tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select selects a single character or bit from a tuple TupleTupleTupletupletuple of integer numbers and/or strings. The input parameter IndexIndexIndexindexindex determines the character or bit position to select. IndexIndexIndexindexindex must contain a single number. If IndexIndexIndexindexindex contains a floating point number, this may only represent an integer value (without fraction). The result tuple SelectedSelectedSelectedselectedselected contains a new element for each element of TupleTupleTupletupletuple. Let IndexIndexIndexindexindex contain the number “n” then each element of SelectedSelectedSelectedselectedselected consists of the “n-th” character (for strings) or “n-th” bit (for integers) of the corresponding element of TupleTupleTupletupletuple.

If TupleTupleTupletupletuple is empty, an exception is raised.

Unicode code points versus bytes

The index reference Unicode code points. One Unicode code point may be composed of multiple bytes in the UTF-8 string. If the index should reference the raw bytes of the string, this operator can be switched to byte mode with set_system('tsp_tuple_string_operator_mode','byte')set_system("tsp_tuple_string_operator_mode","byte")SetSystem("tsp_tuple_string_operator_mode","byte")SetSystem("tsp_tuple_string_operator_mode","byte")set_system("tsp_tuple_string_operator_mode","byte"). If 'filename_encoding'"filename_encoding""filename_encoding""filename_encoding""filename_encoding" is set to 'locale'"locale""locale""locale""locale" (legacy), this operator always uses the byte mode.

For general information about string operations see Tuple / String Operations.

HDevelop In-line Operation

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

Selected := Tuple{Index}

Execution Information

Parameters

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

Input tuple.

IndexIndexIndexindexindex (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Position of character or bit to select.

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

Tuple containing the selected characters and bits.

Alternatives

tuple_selecttuple_selectTupleSelectTupleSelecttuple_select, tuple_first_ntuple_first_nTupleFirstNTupleFirstNtuple_first_n, tuple_last_ntuple_last_nTupleLastNTupleLastNtuple_last_n, tuple_concattuple_concatTupleConcatTupleConcattuple_concat, tuple_strchrtuple_strchrTupleStrchrTupleStrchrtuple_strchr, tuple_strrchrtuple_strrchrTupleStrrchrTupleStrrchrtuple_strrchr, tuple_str_first_ntuple_str_first_nTupleStrFirstNTupleStrFirstNtuple_str_first_n, tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNtuple_str_last_n, tuple_substrtuple_substrTupleSubstrTupleSubstrtuple_substr, tuple_andtuple_andTupleAndTupleAndtuple_and, tuple_ortuple_orTupleOrTupleOrtuple_or, tuple_xortuple_xorTupleXorTupleXortuple_xor, tuple_nottuple_notTupleNotTupleNottuple_not

See also

tuple_removetuple_removeTupleRemoveTupleRemovetuple_remove

Module

Foundation