Operator Reference

tuple_splittuple_splitTupleSplitTupleSplittuple_split (Operator)

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

Signature

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

Description

tuple_splittuple_splitTupleSplitTupleSplittuple_split searches within the strings of the input tuple StringStringStringstringValstring for the separators defined in the input tuple SeparatorSeparatorSeparatorseparatorseparator. tuple_splittuple_splitTupleSplitTupleSplittuple_split then splits the examined strings into the substrings divided by the separators and returns them in the tuple SubstringsSubstringsSubstringssubstringssubstrings. The behavior depends on the length of the input tuples:

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

Please consider, both input tuples (StringStringStringstringValstring and SeparatorSeparatorSeparatorseparatorseparator) may only consist of strings. Otherwise tuple_splittuple_splitTupleSplitTupleSplittuple_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_splitTupleSplitTupleSplittuple_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")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_splittuple_splitTupleSplitTupleSplittuple_split, which can be used in an expression in the following syntax:

Substrings := split(String, Separator)

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

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

Input tuple with string(s) to split.

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

Input tuple with separator symbol(s).

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

Substrings after splitting the input strings.

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