STRING_SEG macro
The STRING_SEG macro is available only in IBM® Campaign.
Syntax
STRING_SEG(from, to, data)
Parameters
from
The number of characters offset from the beginning of the string to start extracting the string segment from. This must be a positive integer greater than zero and less than to, or STRING_SEG returns an empty string.
to
The number of characters offset from the beginning of the string to stop extracting the string segment from. This must be a positive integer greater than or equal to from. If to equals from (and to is less than or equal to the length of the string), one character is returned.
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 IBM® product.
Description
STRING_SEG returns the string segment between two indexes from each string value in the specified data range. If from is greater than the length of a string, nothing is returned. If to is greater than the length of a string, all characters from from are returned.
Examples
Creates a new column named TEMP, which contains the ASCII text string " Jan 15 ".
Creates a new column named TEMP, which contains the ASCII text string " sure ".
Creates a new column named TEMP containing the fifth and sixth characters of each string in column V1.
Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are characters 10-20 of the strings in the corresponding rows of column V1, the values of the VX column are the characters 10-20 of strings in corresponding rows of column V2, and the values of the VY column are the characters 10-20 of the strings in corresponding rows of column V3.
Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are characters 5-10 of the strings in rows 1-50 of column V1, the values of the VX column are characters 5-10 of strings in rows 1-50 of column V2, and the values of the VY column are characters 5-10 of the strings in rows 1-50 of column V3.
Related functions