tuple_splittuple_splitTupleSplitTupleSplittuple_split (算子名称)

名称

tuple_splittuple_splitTupleSplitTupleSplittuple_split — Split strings into substrings using predefined separator symbol(s).

参数签名

tuple_split( : : String, Separator : Substrings)

Herror tuple_split(const char* String, const char* Separator, char* Substrings)

Herror T_tuple_split(const Htuple String, const Htuple Separator, Htuple* Substrings)

void TupleSplit(const HTuple& String, const HTuple& Separator, HTuple* Substrings)

HTuple HTuple::TupleSplit(const HTuple& Separator) const

static void HOperatorSet.TupleSplit(HTuple stringVal, HTuple separator, out HTuple substrings)

HTuple HTuple.TupleSplit(HTuple separator)

def tuple_split(string: MaybeSequence[str], separator: MaybeSequence[str]) -> Sequence[str]

def tuple_split_s(string: MaybeSequence[str], separator: MaybeSequence[str]) -> str

描述

tuple_splittuple_splitTupleSplitTupleSplitTupleSplittuple_split searches within the strings of the input tuple StringStringStringStringstringValstring for the separators defined in the input tuple SeparatorSeparatorSeparatorSeparatorseparatorseparator. tuple_splittuple_splitTupleSplitTupleSplitTupleSplittuple_split then splits the examined strings into the substrings divided by the separators and returns them in the tuple SubstringsSubstringsSubstringsSubstringssubstringssubstrings. The behavior depends on the length of the input tuples:

Notes to SeparatorSeparatorSeparatorSeparatorseparatorseparator: If an element of SeparatorSeparatorSeparatorSeparatorseparatorseparator contains more than one character, each character defines a separator (see the example given above). Subsequent occurrences of SeparatorSeparatorSeparatorSeparatorseparatorseparator in StringStringStringStringstringValstring are treated as one separator. Separators at the beginning and the end of StringStringStringStringstringValstring will not result in an empty string.

Please consider, both input tuples (StringStringStringStringstringValstring and SeparatorSeparatorSeparatorSeparatorseparatorseparator) may only consist of strings. Otherwise tuple_splittuple_splitTupleSplitTupleSplitTupleSplittuple_split returns an error. If both input tuples contain more than one element and the number of elements differs for the input tuples, tuple_splittuple_splitTupleSplitTupleSplitTupleSplittuple_split returns an error.

Unicode code points versus bytes

The split characters are interpreted as Unicode code points. One Unicode code point may be composed of multiple bytes in the UTF-8 string. If the split characters should be handled as 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_splittuple_splitTupleSplitTupleSplitTupleSplittuple_split, which can be used in an expression in the following syntax:

Substrings := split(String, Separator)

运行信息

参数表

StringStringStringStringstringValstring (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple with string(s) to split.

SeparatorSeparatorSeparatorSeparatorseparatorseparator (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple with separator symbol(s).

SubstringsSubstringsSubstringsSubstringssubstringssubstrings (output_control)  string(-array) HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Substrings after splitting the input strings.

可替代算子

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

模块

Foundation