tuple_str_first_n — Cut the first characters up to position “n” out of a string tuple.
tuple_str_first_n cuts the first characters up to position “n” out of each string of the input tuple String and returns them as new strings in the output tuple Substring (remark: the position within strings starts with 0 for the first character of a string). The number “n” is determined by the second input tuple Position. If Position only contains one element, this element contains the number “n”. If String and Position have got the same number of elements, the first element of Position determines the position “n” for the first string of String, the second element of Position does so for the second string of String and so on. If Position contains more than one element and String contains only one string, tuple_str_first_n cuts more than one substrings out of this string. The elements of Position then determine the lengths of these substrings. If both input tuples contain more than one element but differ in the number of elements, tuple_str_first_n returns an error.
For general information about string operations see Tuple / String Operations.
If both input tuples are empty, the operator returns an empty tuple. Similarly, if String is empty and Position is not, the operator returns an empty tuple. In contrast, if Position is empty and String is not, an exception is raised.
HDevelop provides an in-line operation for tuple_str_first_n, which can be used in an expression in the following syntax:
Substring := str_firstn(String, Position)
Input tuple with string(s) to examine.
Input tuple with position(s) “n”.
The first characters of the string(s) up to position “n”.
tuple_str_last_n, tuple_substr, tuple_strstr, tuple_strrstr, tuple_strlen, tuple_strchr, tuple_strrchr, tuple_split, tuple_environment