Xbasic

*LINE_REPLACE Function

Syntax

New_String as C = *LINE_REPLACE(text as c,insert as c,line as n[,nlines as n])

Arguments

textCharacter

The original unmodified text.

insertCharacter

The text to insert.

lineNumeric

The number of the first line to replace.

nlinesNumeric

Default = 1. The number of lines to replace.

Returns

New_StringCharacter

The modified text containing line replacement(s).

Description

Replace line(s) of text at word position (1 line replaced if nlines ommitted).

Discussion

The *LINE_REPLACE() function replaces line(s) of text in a CR-LF delimited string.

Example

lines = <<%str%
one
two
three
four
%str%

? *line_replace(lines, "THREE!!", 3)
= one
two
THREE!!
four

? *line_replace(lines,"TWO AND THREE", 2, 2)
= one
TWO AND THREE
four

See Also