Release Notes December 1, 2023#

No new features for Observe instances.

OPAL Language Updates#

substring#

Description#

Extracts characters from a string, starting at an index. Negative indices count from the end of the string. Positive indices start at 0. Takes an optional length parameter. Returns an empty string if the optional length parameter is not positive.

Return type#

string

Domain#

This is a scalar function (calculates a single output value for a single input row.)

Categories#

Usage#

substring( value, start [ , length ] )

Argument

Type

Required

Multiple

Constant

value

string

Required

Only one

Variable

start

int64

Required

Only one

Variable

length

int64

Optional

Only one

Variable

Examples#

make_col substr:substring('mystring', 2)

Returns the substring starting from position 2 till the end of the string, which is ‘string’.

make_col substr:substring('mystring', 2, 4)

Returns the substring starting from position 2 with a length of 4, which is ‘stri’.

make_col substr:substring('mystring', -4, 2)

Returns the substring starting from four characters from the end with a length of 2, which is ‘ri’.

make_col substr:substring('mystring', 2, -2)

Returns an empty string as the length is not positive.