tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNtuple_str_last_n (Operator)

Name

tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNtuple_str_last_n — Cut all characters starting at position “n” out of a string tuple.

Signature

tuple_str_last_n( : : String, Position : Substring)

Herror tuple_str_last_n(const char* String, const Hlong Position, char* Substring)

Herror T_tuple_str_last_n(const Htuple String, const Htuple Position, Htuple* Substring)

void TupleStrLastN(const HTuple& String, const HTuple& Position, HTuple* Substring)

HTuple HTuple::TupleStrLastN(const HTuple& Position) const

static void HOperatorSet.TupleStrLastN(HTuple stringVal, HTuple position, out HTuple substring)

HTuple HTuple.TupleStrLastN(HTuple position)

def tuple_str_last_n(string: MaybeSequence[str], position: MaybeSequence[Union[float, int]]) -> Sequence[str]

def tuple_str_last_n_s(string: MaybeSequence[str], position: MaybeSequence[Union[float, int]]) -> str

Description

tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNTupleStrLastNtuple_str_last_n cuts all characters from position “n” to the end of the string out of each string of the input tuple StringStringStringStringstringValstring and returns them as new strings in the output tuple SubstringSubstringSubstringSubstringsubstringsubstring. The position “n” is determined by the second input tuple PositionPositionPositionPositionpositionposition. If PositionPositionPositionPositionpositionposition only contains one element, this element contains “n”. If StringStringStringStringstringValstring and PositionPositionPositionPositionpositionposition have got the same number of elements, the first element of PositionPositionPositionPositionpositionposition determines the start position for the first string of StringStringStringStringstringValstring, the second element of PositionPositionPositionPositionpositionposition does so for the second string of StringStringStringStringstringValstring and so on. If PositionPositionPositionPositionpositionposition contains more than one element and StringStringStringStringstringValstring contains only one string, tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNTupleStrLastNtuple_str_last_n cuts more than one substrings out of this string. The elements of PositionPositionPositionPositionpositionposition then determine the start positions for these substrings. If both input tuples contain more than one element but differ in the number of elements, tuple_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNTupleStrLastNtuple_str_last_n returns an error.

If both input tuples are empty, the operator returns an empty tuple. Similarly, if StringStringStringStringstringValstring is empty and PositionPositionPositionPositionpositionposition is not, the operator returns an empty tuple. In contrast, if PositionPositionPositionPositionpositionposition is empty and StringStringStringStringstringValstring is not, an exception is raised.

Unicode code points versus bytes

The position references Unicode code points. One Unicode code point may be composed of multiple bytes in the UTF-8 string. If the position should reference the 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")set_system("tsp_tuple_string_operator_mode","byte"). If 'filename_encoding'"filename_encoding""filename_encoding""filename_encoding""filename_encoding""filename_encoding" is set to 'locale'"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_str_last_ntuple_str_last_nTupleStrLastNTupleStrLastNTupleStrLastNtuple_str_last_n, which can be used in an expression in the following syntax:

Substring := str_lastn(String, Position)

Execution Information

Parameters

StringStringStringStringstringValstring (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple with string(s) to examine.

PositionPositionPositionPositionpositionposition (input_control)  number(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Input tuple with position(s) “n”.

SubstringSubstringSubstringSubstringsubstringsubstring (output_control)  string(-array) HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

The last characters of the string(s) starting at position “n”.

Alternatives

tuple_str_first_ntuple_str_first_nTupleStrFirstNTupleStrFirstNTupleStrFirstNtuple_str_first_n, tuple_substrtuple_substrTupleSubstrTupleSubstrTupleSubstrtuple_substr, tuple_strstrtuple_strstrTupleStrstrTupleStrstrTupleStrstrtuple_strstr, tuple_strrstrtuple_strrstrTupleStrrstrTupleStrrstrTupleStrrstrtuple_strrstr, tuple_strlentuple_strlenTupleStrlenTupleStrlenTupleStrlentuple_strlen, tuple_strchrtuple_strchrTupleStrchrTupleStrchrTupleStrchrtuple_strchr, tuple_strrchrtuple_strrchrTupleStrrchrTupleStrrchrTupleStrrchrtuple_strrchr, tuple_splittuple_splitTupleSplitTupleSplitTupleSplittuple_split, tuple_environmenttuple_environmentTupleEnvironmentTupleEnvironmentTupleEnvironmenttuple_environment

Module

Foundation