tuple_jointuple_joinTupleJoinTupleJointuple_join (算子)
名称
tuple_jointuple_joinTupleJoinTupleJointuple_join — 使用分隔符连接字符串。
签名
def tuple_join(strings: MaybeSequence[str], separators: MaybeSequence[str]) -> Sequence[str]
def tuple_join_s(strings: MaybeSequence[str], separators: MaybeSequence[str]) -> str
描述
tuple_jointuple_joinTupleJoinTupleJoinTupleJointuple_join joins the strings of the input tuple
StringsStringsStringsStringsstringsstrings interleaved with the separators defined in the input tuple
SeparatorsSeparatorsSeparatorsSeparatorsseparatorsseparators and returns the result in the tuple
JoinedStringsJoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_strings。
For each string element in SeparatorsSeparatorsSeparatorsSeparatorsseparatorsseparators, there is one corresponding
element in JoinedStringsJoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_strings which holds the elements of StringsStringsStringsStringsstringsstrings
joined by this separator.
Thereby an empty string in SeparatorsSeparatorsSeparatorsSeparatorsseparatorsseparators corresponds to simple
string concatenation.
Example: StringsStringsStringsStringsstringsstrings = ['aaa', 'bbb', 'ccc', 'ddd']["aaa", "bbb", "ccc", "ddd"]["aaa", "bbb", "ccc", "ddd"]["aaa", "bbb", "ccc", "ddd"]["aaa", "bbb", "ccc", "ddd"]["aaa", "bbb", "ccc", "ddd"]
and SeparatorsSeparatorsSeparatorsSeparatorsseparatorsseparators = ['++', '--', '']["++", "--", ""]["++", "--", ""]["++", "--", ""]["++", "--", ""]["++", "--", ""].
In this case the operator returns the tuple JoinedStringsJoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_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"]["aaa++bbb++ccc++ddd", "aaa--bbb--ccc--ddd", "aaabbbcccddd"].
Both input tuples (StringsStringsStringsStringsstringsstrings and SeparatorsSeparatorsSeparatorsSeparatorsseparatorsseparators)
may only consist of strings.
Otherwise tuple_jointuple_joinTupleJoinTupleJoinTupleJointuple_join returns an error.
例外:空输入元组
If either or both of the input tuples are empty, the operator returns an
empty tuple.
Unicode 码点与字节
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""tsp_tuple_string_operator_mode".
For general information about string operations see
Tuple / String Operations。
HDevelop 内联操作
HDevelop provides an in-line operation for tuple_jointuple_joinTupleJoinTupleJoinTupleJointuple_join, which can be
used in an expression in the following syntax:
JoinedStrings := join(Strings, Separators)
执行信息
- 多线程类型:独立(即使使用独占算子也能并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
StringsStringsStringsStringsstringsstrings (输入控制) string(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Input tuple with strings to join.
SeparatorsSeparatorsSeparatorsSeparatorsseparatorsseparators (输入控制) string(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Input tuple with separator symbol(s).
JoinedStringsJoinedStringsJoinedStringsJoinedStringsjoinedStringsjoined_strings (输出控制) string(-array) → HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Output tuple with the contained strings.
可能的后继
tuple_splittuple_splitTupleSplitTupleSplitTupleSplittuple_split
替代
tuple_strstrtuple_strstrTupleStrstrTupleStrstrTupleStrstrtuple_strstr,
tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrTupleStrrstrtuple_strrstr,
tuple_strchrtuple_strchrTupleStrchrTupleStrchrTupleStrchrtuple_strchr,
tuple_strrchrtuple_strrchrTupleStrrchrTupleStrrchrTupleStrrchrtuple_strrchr,
tuple_strlentuple_strlenTupleStrlenTupleStrlenTupleStrlentuple_strlen,
tuple_str_first_ntuple_str_first_nTupleStrFirstNTupleStrFirstNTupleStrFirstNtuple_str_first_n,
tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNTupleStrLastNtuple_str_last_n,
tuple_environmenttuple_environmentTupleEnvironmentTupleEnvironmentTupleEnvironmenttuple_environment
模块
基础