tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select (算子名称)
名称
tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select — Select single character or bit from a tuple.
参数签名
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]
描述
tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select selects a single character or bit from
a tuple TupleTupleTupleTupletupletuple of integer numbers and/or strings.
The input parameter IndexIndexIndexIndexindexindex determines the character or bit
position to select. IndexIndexIndexIndexindexindex must contain a single number. If
IndexIndexIndexIndexindexindex contains a floating point number, this may only
represent an integer value (without fraction). The result tuple
SelectedSelectedSelectedSelectedselectedselected contains a new element for each element of
TupleTupleTupleTupletupletuple. Let IndexIndexIndexIndexindexindex contain the number “n” then each
element of SelectedSelectedSelectedSelectedselectedselected consists of the “n-th” character
(for strings) or “n-th” bit (for integers) of the corresponding
element of TupleTupleTupleTupletupletuple.
If TupleTupleTupleTupletupletuple 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")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""filename_encoding" is set to 'locale'"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_selectTupleStrBitSelectTupleStrBitSelectTupleStrBitSelecttuple_str_bit_select,
which can be used in an expression in the following syntax:
Selected := Tuple{Index}
运行信息
- Multithreading type: independent (runs in parallel even with exclusive operators).
- 多线程作用域:全局(可以从任何线程调用)。
- 未经并行化处理。
参数表
TupleTupleTupleTupletupletuple (input_control) tuple(-array) → HTupleMaybeSequence[Union[str, int]]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Input tuple.
IndexIndexIndexIndexindexindex (input_control) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Position of character or bit to select.
SelectedSelectedSelectedSelectedselectedselected (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.
可替代算子
tuple_selecttuple_selectTupleSelectTupleSelectTupleSelecttuple_select,
tuple_first_ntuple_first_nTupleFirstNTupleFirstNTupleFirstNtuple_first_n,
tuple_last_ntuple_last_nTupleLastNTupleLastNTupleLastNtuple_last_n,
tuple_concattuple_concatTupleConcatTupleConcatTupleConcattuple_concat,
tuple_strchrtuple_strchrTupleStrchrTupleStrchrTupleStrchrtuple_strchr,
tuple_strrchrtuple_strrchrTupleStrrchrTupleStrrchrTupleStrrchrtuple_strrchr,
tuple_str_first_ntuple_str_first_nTupleStrFirstNTupleStrFirstNTupleStrFirstNtuple_str_first_n,
tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNTupleStrLastNtuple_str_last_n,
tuple_substrtuple_substrTupleSubstrTupleSubstrTupleSubstrtuple_substr,
tuple_andtuple_andTupleAndTupleAndTupleAndtuple_and,
tuple_ortuple_orTupleOrTupleOrTupleOrtuple_or,
tuple_xortuple_xorTupleXorTupleXorTupleXortuple_xor,
tuple_nottuple_notTupleNotTupleNotTupleNottuple_not
参考其它
tuple_removetuple_removeTupleRemoveTupleRemoveTupleRemovetuple_remove
模块
Foundation