ClassesClasses | | Operators

tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstr (Operator)

Name

tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstr — Backward search for strings within a string tuple.

Signature

tuple_strrstr( : : String, ToFind : Position)

Herror tuple_strrstr(const char* String, const char* ToFind, Hlong* Position)

Herror T_tuple_strrstr(const Htuple String, const Htuple ToFind, Htuple* Position)

void TupleStrrstr(const HTuple& String, const HTuple& ToFind, HTuple* Position)

HTuple HTuple::TupleStrrstr(const HTuple& ToFind) const

static void HOperatorSet.TupleStrrstr(HTuple stringVal, HTuple toFind, out HTuple position)

HTuple HTuple.TupleStrrstr(HTuple toFind)

Description

tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrTupleStrrstr searches within the strings of the input tuple StringStringStringStringstringVal for the strings of the input tuple ToFindToFindToFindToFindtoFind. Both input tuples may only consist of strings. Otherwise tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrTupleStrrstr returns an error. In any case backward search is used, i.e., every string is examined from its last to its first character. If StringStringStringStringstringVal contains only one string, all strings of ToFindToFindToFindToFindtoFind are searched in it. Thus, the output tuple consists of as many elements as ToFindToFindToFindToFindtoFind. Whenever a searched string has been found, the position of its first occurrence gets stored in the output tuple PositionPositionPositionPositionposition (positions in strings are counted starting with 0). If a string can not be found, -1 will be returned instead of its position. If both input tuples show the same number of elements, the strings are searched elementwise. I.e., the first string of ToFindToFindToFindToFindtoFind is searched within the first string of StringStringStringStringstringVal, the second string of ToFindToFindToFindToFindtoFind is searched within the second string of StringStringStringStringstringVal and so on. The results of the elementwise searches are returned with PositionPositionPositionPositionposition that contains as many elements as StringStringStringStringstringVal and ToFindToFindToFindToFindtoFind. If ToFindToFindToFindToFindtoFind only contains one string, this is searched within all strings of StringStringStringStringstringVal. Thus, in this case PositionPositionPositionPositionposition consists of as many elements as StringStringStringStringstringVal. If both input tuples contain more than one element and the number of elements differs for the input tuples, tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrTupleStrrstr returns an error.

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

Exception: Empty input tuples

If either or both of the input tuples are empty, the operator returns an empty tuple.

HDevelop In-line Operation

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

Position := strrstr(String, ToFind)

Execution Information

Parameters

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

Input tuple with string(s) to examine.

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

Input tuple with string(s) to search.

PositionPositionPositionPositionposition (output_control)  integer(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Position of searched string(s) within the examined string(s).

Alternatives

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

Module

Foundation


ClassesClasses | | Operators