Skip to content

tuple_splitTupleSplitTupleSplittuple_splittuple_split🔗

Short description🔗

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

Signature🔗

tuple_split( string String, string Separator, out string Substrings )void TupleSplit( const HTuple& String, const HTuple& Separator, HTuple* Substrings )static void HOperatorSet.TupleSplit( HTuple stringVal, HTuple separator, out HTuple substrings )def tuple_split( string: MaybeSequence[str], separator: MaybeSequence[str] ) -> Sequence[str]

def tuple_split_s( string: MaybeSequence[str], separator: MaybeSequence[str] ) -> strHerror tuple_split( const char* String, const char* Separator, char* Substrings )

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

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

HTuple HTuple.TupleSplit( HTuple separator )

Description🔗

tuple_splitTupleSplit searches within the strings of the input tuple StringstringValstring for the separators defined in the input tuple Separatorseparatorseparator. tuple_splitTupleSplit then splits the examined strings into the substrings divided by the separators and returns them in the tuple Substringssubstringssubstrings. The behavior depends on the length of the input tuples:

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

Please consider, both input tuples (StringstringValstring and Separatorseparatorseparator) may only consist of strings. Otherwise tuple_splitTupleSplit returns an error. If both input tuples contain more than one element and the number of elements differs for the input tuples, tuple_splitTupleSplit 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'). If 'filename_encoding'"filename_encoding" is set to '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_splitTupleSplit, which can be used in an expression in the following syntax:

Substrings := split(String, Separator)

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

StringstringValstring (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Input tuple with string(s) to split.

Separatorseparatorseparator (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Input tuple with separator symbol(s).

Substringssubstringssubstrings (output_control) string(-array) → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Substrings after splitting the input strings.

Combinations with other operators🔗

Combinations

Alternatives

tuple_strstrTupleStrstr, tuple_strrstrTupleStrrstr, tuple_strchrTupleStrchr, tuple_strrchrTupleStrrchr, tuple_strlenTupleStrlen, tuple_str_first_nTupleStrFirstN, tuple_str_last_nTupleStrLastN, tuple_environmentTupleEnvironment

Module🔗

Foundation