REPLLINES

The REPLLINES function replaces one or more lines in a multiline TEXT expression.

Return Value

TEXT or NTEXT

This function accepts TEXT values and NTEXT values as arguments. The data type of the return value depends on the data type of the values specified for the arguments. When all arguments are TEXT values, the return value is TEXT. When all arguments are NTEXT values, the return value is NTEXT. When the arguments include both TEXT and NTEXT values, the function converts all TEXT values to NTEXT before performing the function operation, and the return value is NTEXT.

Syntax

REPLLINES(text-expression lines [start])

Parameters

text-expression

A multiline text expression in which you want to replace one or more lines.

lines

A text expression that contains one or more lines that replace the existing lines in text-expression.

start

An INTEGER that represents the line number at which to begin replacing. The position of the first line in text-expression is 1. When you omit this argument, REPLLINES starts with line 1. REPLLINES replaces as many lines of text-expression as are required for the specified new lines.

Examples

Example 8-81 Replacing a Text Line

This example shows how to replace the second line in a multiline TEXT value in a variable called mktglist. Assume first that the statement SHOW mktglist produces the following output.

Salespeople
Products
Services

By using REPLLINES, you can display a different value for "Products".

SHOW REPLLINES(mktglist, 'advertising', 2)
Salespeople
Advertising
Services