Xbasic

*WORD_REPLACE Function

Syntax

New_String as C = *WORD_REPLACE(text as c,insert as c,word as n,separator as c[,nwords as n])

Arguments

New_String

The string containing the replacement(s).

text

The starting string.

insert

The text to insert.

word

The number of the first word to replace. Numeric

separator

The word separator character(s).

nwords

Optional. Default = 1. The number of words to replace. Numeric

Description

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

Discussion

The *WORD_REPLACE() function replaces one or more words in a list.

Example

? *word_replace("one two three four","THREE!!",3," ")
= "one two THREE!! four"
? *word_replace("one two three four","TWO AND THREE",2," ",2)
= "one TWO AND THREE four"

See Also