tuple_strlentuple_strlenTupleStrlenTupleStrlentuple_strlen (Operator)
Name
tuple_strlentuple_strlenTupleStrlenTupleStrlentuple_strlen
— Determine the length of every string within a tuple of strings.
Signature
Herror tuple_strlen(const char* T1, Hlong* Length)
Herror T_tuple_strlen(const Htuple T1, Htuple* Length)
def tuple_strlen(t1: MaybeSequence[str]) -> Sequence[int]
def tuple_strlen_s(t1: MaybeSequence[str]) -> int
Description
tuple_strlentuple_strlenTupleStrlenTupleStrlentuple_strlen
checks the length of every string within the
input tuple T1T1T1t1t1
and returns the length of each string with
the output tuple LengthLengthLengthlengthlength
. All elements of T1T1T1t1t1
may only consist of strings. Otherwise tuple_strlentuple_strlenTupleStrlenTupleStrlentuple_strlen
returns an
error.
If the input tuple is empty, the operator returns an empty tuple.
Unicode code points versus bytes
The string length references Unicode code points. One Unicode code point may
be composed of multiple bytes in the UTF-8 string. If the length 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_strlentuple_strlenTupleStrlenTupleStrlentuple_strlen
,
which can be used in an expression in the following syntax:
Length := strlen(T1)
Execution Information
- Multithreading type: independent (runs in parallel even with exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
T1T1T1t1t1
(input_control) string(-array) →
HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Input tuple.
LengthLengthLengthlengthlength
(output_control) integer(-array) →
HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Lengths of the single strings of the input tuple.
Alternatives
tuple_strstrtuple_strstrTupleStrstrTupleStrstrtuple_strstr
,
tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrtuple_strrstr
,
tuple_strchrtuple_strchrTupleStrchrTupleStrchrtuple_strchr
,
tuple_strrchrtuple_strrchrTupleStrrchrTupleStrrchrtuple_strrchr
,
tuple_substrtuple_substrTupleSubstrTupleSubstrtuple_substr
,
tuple_str_first_ntuple_str_first_nTupleStrFirstNTupleStrFirstNtuple_str_first_n
,
tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNtuple_str_last_n
,
tuple_splittuple_splitTupleSplitTupleSplittuple_split
,
tuple_environmenttuple_environmentTupleEnvironmentTupleEnvironmenttuple_environment
See also
tuple_is_stringtuple_is_stringTupleIsStringTupleIsStringtuple_is_string
Module
Foundation