Stuff

Strings
Aptilis 1

Stuff(String)

stuff uses a special syntax: !(varname) to insert variables in a string. You can prepare a string and indicate where you want the variable to be inserted. Stuff will replace all the occurrences of !(varName) with the value of varName. Of course you can use different variables as well as the same variable several times.
Stuff is especially useful for CGI scripts, where you may want to change the looks of an HTML page coming out of a script, without having to go back into a programme.

Return value:
A new string where the variables have been replaced by their values.

Example:
(Note that one of the variables, age, has not been defined)

template = "Welcome !(name). You are !(age) years old." $
name = "John" $
print(stuff(template$)$)
Result:
Welcome John. You are  years old.

Notes: