STRING_LENGTH macro

The STRING_LENGTH macro is available only in Unica Campaign.

Syntax

STRING_LENGTH(data)

Parameters

data

ASCII text string values to compute the length of. 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_LENGTH returns the length of each string value in the specified data range. It returns one new column for each input column, each containing the length of the corresponding text string.

Note: If STRING_LENGTH is applied to columns containing numerical data, it returns zeros.

Examples

TEMP = STRING_LENGTH("four")

Creates a new column named TEMP containing the value 4.

TEMP = STRING_LENGTH(4)

Creates a new column named TEMP containing the value 0.

TEMP = STRING_LENGTH(V1)

Creates a new column named TEMP, where each value is the length of the string in the corresponding row of column V1.

TEMP = STRING_LENGTH(V1:V3)

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

TEMP = STRING_LENGTH(V4[1:50]:V6]

Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are the lengths of the strings in rows 1-50 of column V1, the values of the VX column are the lengths of strings in rows 1-50 of column V2, and the values of the VY column are the lengths 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_SEG Returns the string segment between two specified indexes
STRING_TAIL Returns the last n characters of each string in the specified data range