tuple_jointuple_joinTupleJoinTupleJointuple_join (Operator)
Name
tuple_jointuple_joinTupleJoinTupleJointuple_join
— Join strings using separator symbol(s).
Signature
def tuple_join(strings: MaybeSequence[str], separators: MaybeSequence[str]) -> Sequence[str]
def tuple_join_s(strings: MaybeSequence[str], separators: MaybeSequence[str]) -> str
Description
tuple_jointuple_joinTupleJoinTupleJointuple_join
joins the strings of the input tuple
StringsStringsStringsstringsstrings
interleaved with the separators defined in the input tuple
SeparatorsSeparatorsSeparatorsseparatorsseparators
and returns the result in the tuple
JoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_strings
.
For each string element in SeparatorsSeparatorsSeparatorsseparatorsseparators
, there is one corresponding
element in JoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_strings
which holds the elements of StringsStringsStringsstringsstrings
joined by this separator.
Thereby an empty string in SeparatorsSeparatorsSeparatorsseparatorsseparators
corresponds to simple
string concatenation.
Example: StringsStringsStringsstringsstrings
= ['aaa', 'bbb', 'ccc', 'ddd']["aaa", "bbb", "ccc", "ddd"]["aaa", "bbb", "ccc", "ddd"]["aaa", "bbb", "ccc", "ddd"]["aaa", "bbb", "ccc", "ddd"]
and SeparatorsSeparatorsSeparatorsseparatorsseparators
= ['++', '--', '']["++", "--", ""]["++", "--", ""]["++", "--", ""]["++", "--", ""].
In this case the operator returns the tuple JoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_strings
=
['aaa++bbb++ccc++ddd', 'aaa--bbb--ccc--ddd', 'aaabbbcccddd']["aaa++bbb++ccc++ddd", "aaa--bbb--ccc--ddd", "aaabbbcccddd"]["aaa++bbb++ccc++ddd", "aaa--bbb--ccc--ddd", "aaabbbcccddd"]["aaa++bbb++ccc++ddd", "aaa--bbb--ccc--ddd", "aaabbbcccddd"]["aaa++bbb++ccc++ddd", "aaa--bbb--ccc--ddd", "aaabbbcccddd"].
Both input tuples (StringsStringsStringsstringsstrings
and SeparatorsSeparatorsSeparatorsseparatorsseparators
)
may only consist of strings.
Otherwise tuple_jointuple_joinTupleJoinTupleJointuple_join
returns an error.
Exception: Empty input tuples
If either or both of the input tuples are empty, the operator returns an
empty tuple.
Unicode code points versus bytes
A separator always consists of the entire string.
This is true regardless of the system setting of
'tsp_tuple_string_operator_mode'"tsp_tuple_string_operator_mode""tsp_tuple_string_operator_mode""tsp_tuple_string_operator_mode""tsp_tuple_string_operator_mode".
For general information about string operations see
Tuple / String Operations.
HDevelop In-line Operation
HDevelop provides an in-line operation for tuple_jointuple_joinTupleJoinTupleJointuple_join
, which can be
used in an expression in the following syntax:
JoinedStrings := join(Strings, Separators)
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
StringsStringsStringsstringsstrings
(input_control) string(-array) →
HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Input tuple with strings to join.
SeparatorsSeparatorsSeparatorsseparatorsseparators
(input_control) string(-array) →
HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Input tuple with separator symbol(s).
JoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_strings
(output_control) string(-array) →
HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Output tuple with the contained strings.
Possible Successors
tuple_splittuple_splitTupleSplitTupleSplittuple_split
Alternatives
tuple_strstrtuple_strstrTupleStrstrTupleStrstrtuple_strstr
,
tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrtuple_strrstr
,
tuple_strchrtuple_strchrTupleStrchrTupleStrchrtuple_strchr
,
tuple_strrchrtuple_strrchrTupleStrrchrTupleStrrchrtuple_strrchr
,
tuple_strlentuple_strlenTupleStrlenTupleStrlentuple_strlen
,
tuple_str_first_ntuple_str_first_nTupleStrFirstNTupleStrFirstNtuple_str_first_n
,
tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNtuple_str_last_n
,
tuple_environmenttuple_environmentTupleEnvironmentTupleEnvironmenttuple_environment
Module
Foundation