fn: replace_all

[contents]

Contents

Syntax

The syntax for replace_all calls is:

f++:  
replace_all(string, string, string)

n++:  
@replace_all(string, string, string)

Description

The replace_all function is for finding and replacing all occurences of a string within another string, it takes three string parameters, the first parameter is the string to search within, the second string is what to search for and replace, and the third string is what to replace the second string with.

Note: When building files you can use ofile for the first parameter to find and replace within the output for the file built up to that point, see examples below. This should be avoided unless absolutely necessary as it is not an efficient thing to do.

f++ example

Example of replace_all being used with f++:

replace_all("hello, world!", "world", "mars")

n++ example

Examples of replace_all being used with n++:

@replace_all("hello, world!", "world", "mars")

@replace_all(ofile, "%name", "index")