STRING_TAIL macro

The STRING_TAIL macro is available only in Unica Campaign.

Syntax

STRING_TAIL(num_chars, data)

Parameters

num_chars

The number of characters to returns from the end of each string in data. This must be a positive integer greater than zero.

data

ASCII text string values. This can be ASCII text in quotes, a column of text, a cell range containing text, or an expression evaluating to any of the above. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your product.

Description

STRING_TAIL returns the last num_chars characters from each string value in the specified data range. All string values are padded to the length of the longest string with null characters " \0 ". Then the last num_chars are returned from each string. If num_chars is greater than the number of characters in a text string, the entire text string is returned.

Examples

TEMP = STRING_TAIL(3, "JAN 15, 1997")

Creates a new column named TEMP, which contains the ASCII text string " 997 ".

TEMP = STRING_TAIL(10, "Pressure")

Creates a new column named TEMP, which contains the ASCII text string " Pressure ".

TEMP = STRING_TAIL(5, V1)

Creates a new column named TEMP containing the last five characters of each string in column V1.

TEMP = STRING_TAIL(1, V1:V3)

Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are the last characters of the strings in the corresponding rows of column V1, the values of the VX column are the last characters of strings in corresponding rows of column V2, and the values of the VY column are the last characters of the strings in corresponding rows of column V3.

TEMP = STRING_TAIL(12, V4[1:50]:V6]

Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are the last 12 characters of the strings in rows 1-50 of column V1, the values of the VX column are the last 12 characters of strings in rows 1-50 of column V2, and the values of the VY column are the last 12 characters of the strings in rows 1-50 of column V3.

Related functions

Function Description
STRING_CONCAT Concatenates two text strings from the specified data ranges
STRING_HEAD Returns the first n characters of each string in the specified data range
STRING_LENGTH Returns the length of each string in the specified data range
STRING_SEG Returns the string segment between two specified indexes