18.3 Replacing and Inserting

18.3.1 replace

Synopsis

replace(source, from, to);

Description

replace () takes string source and replace the first occurrence of substring from with substring to; after that, returns the result.

source, from and to can be any valid expression.

Example

replace (outputfile (), "main/", "acc/");

Return the output file name replacing substring main/ with acc/. If you have two version of every page, with similar file names, this is an easy way to provide links between them.

18.3.2 replaceall

Synopsis

replaceall(source, from, to);

Description

replaceall () takes string source and replace all occurrences of substring from with substring to; after that, returns the result.

source, from and to can be any valid expression.

18.3.3 insert

Synopsis

insert(source, index, new_string);

Description

Return a new string created inserting new_string into source, at character index.

This manual can be downloaded from http://www.g-cows.org/.