tuple_splittuple_splitTupleSplitTupleSplit (Operator)

Name

tuple_splittuple_splitTupleSplitTupleSplit — 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)

Description

tuple_splittuple_splitTupleSplitTupleSplitTupleSplit searches within the strings of the input tuple StringStringStringStringstringVal for the separators defined in the input tuple SeparatorSeparatorSeparatorSeparatorseparator. tuple_splittuple_splitTupleSplitTupleSplitTupleSplit 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 StringStringStringStringstringVal are treated as one separator. Separators at the beginning and the end of StringStringStringStringstringVal will not result in an empty string.

Please consider, both input tuples (StringStringStringStringstringVal and SeparatorSeparatorSeparatorSeparatorseparator) may only consist of strings. Otherwise tuple_splittuple_splitTupleSplitTupleSplitTupleSplit returns an error. If both input tuples contain more than one element and the number of elements differs for the input tuples, tuple_splittuple_splitTupleSplitTupleSplitTupleSplit 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"). 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_splitTupleSplitTupleSplitTupleSplit, which can be used in an expression in the following syntax:

Substrings := split(String, Separator)

Execution Information

Parameters

StringStringStringStringstringVal (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Input tuple with string(s) to split.

SeparatorSeparatorSeparatorSeparatorseparator (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Input tuple with separator symbol(s).

SubstringsSubstringsSubstringsSubstringssubstrings (output_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Substrings after splitting the input strings.

Alternatives

tuple_strstrtuple_strstrTupleStrstrTupleStrstrTupleStrstr, tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrTupleStrrstr, tuple_strchrtuple_strchrTupleStrchrTupleStrchrTupleStrchr, tuple_strrchrtuple_strrchrTupleStrrchrTupleStrrchrTupleStrrchr, tuple_strlentuple_strlenTupleStrlenTupleStrlenTupleStrlen, tuple_str_first_ntuple_str_first_nTupleStrFirstNTupleStrFirstNTupleStrFirstN, tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNTupleStrLastN, tuple_environmenttuple_environmentTupleEnvironmentTupleEnvironmentTupleEnvironment

Module

Foundation