ClassesClasses | | Operators

tuple_substrtuple_substrTupleSubstrTupleSubstr (Operator)

Name

tuple_substrtuple_substrTupleSubstrTupleSubstr — Cut characters from position “n1” through “n2” out of a string tuple.

Signature

tuple_substr( : : String, Position1, Position2 : Substring)

Herror tuple_substr(const char* String, const Hlong Position1, const Hlong Position2, char* Substring)

Herror T_tuple_substr(const Htuple String, const Htuple Position1, const Htuple Position2, Htuple* Substring)

void TupleSubstr(const HTuple& String, const HTuple& Position1, const HTuple& Position2, HTuple* Substring)

HTuple HTuple::TupleSubstr(const HTuple& Position1, const HTuple& Position2) const

static void HOperatorSet.TupleSubstr(HTuple stringVal, HTuple position1, HTuple position2, out HTuple substring)

HTuple HTuple.TupleSubstr(HTuple position1, HTuple position2)

Description

tuple_substrtuple_substrTupleSubstrTupleSubstrTupleSubstr cuts all characters from position “n1” through “n2” out of each string of the input tuple StringStringStringStringstringVal and returns them as new strings in the output tuple SubstringSubstringSubstringSubstringsubstring. The positions “n1” and “n2” are determined by the second and third input tuples Position1Position1Position1Position1position1 and Position2Position2Position2Position2position2. Their length has to be equal. If Position1Position1Position1Position1position1 and Position2Position2Position2Position2position2 only contain one element, this element defines for all strings of StringStringStringStringstringVal “n1” and “n2”, respectively . If StringStringStringStringstringVal, Position1Position1Position1Position1position1 and Position2Position2Position2Position2position2 have got the same number of elements, the first elements of Position1Position1Position1Position1position1 and Position2Position2Position2Position2position2 determine the start and end position for the first string of StringStringStringStringstringVal. The second elements of Position1Position1Position1Position1position1 and Position2Position2Position2Position2position2 do so for the second string of StringStringStringStringstringVal and so on. If Position1Position1Position1Position1position1 and Position2Position2Position2Position2position2 contain more than one element and StringStringStringStringstringVal contains only one string, tuple_substrtuple_substrTupleSubstrTupleSubstrTupleSubstr cuts more than one substring out of this string. The elements of Position1Position1Position1Position1position1 and Position2Position2Position2Position2position2 then determine the start and end positions for these substrings. If all input tuples contain more than one element but differ in the number of elements, tuple_substrtuple_substrTupleSubstrTupleSubstrTupleSubstr returns an error.

For general information about string operations see Tuple / String Operations.

Exception: Empty input tuples

If StringStringStringStringstringVal is an empty tuple, the operator returns an empty tuple. If StringStringStringStringstringVal is not empty and Position1Position1Position1Position1position1 and/or Position2Position2Position2Position2position2 are empty tuples, an exception is raised.

HDevelop In-line Operation

HDevelop provides an in-line operation for tuple_substrtuple_substrTupleSubstrTupleSubstrTupleSubstr, which can be used in an expression in the following syntax:

Substring := String{Position1:Position2}

Execution Information

Parameters

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

Input tuple with string(s) to examine.

Position1Position1Position1Position1position1 (input_control)  number(-array) HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Input tuple with start position(s) “n1”.

Position2Position2Position2Position2position2 (input_control)  number(-array) HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Input tuple with end position(s) “n2”.

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

Characters of the string(s) from position “n1” to “n2”.

Alternatives

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

Module

Foundation


ClassesClasses | | Operators