The CHANGE subroutine searches for and replaces text in a character matrix. The arguments to the CHANGE call are as follows:
is a character matrix.
is the string to be changed.
is the string to replace the old string.
is the number of times to make the change.
The CHANGE subroutine changes the first numchange occurrences of the substring old in each element of the character array matrix to the form new. If numchange is not specified, the routine defaults to 1. If numchange is 0, the routine changes all occurrences of old. If no occurrences are found, the matrix is not changed.
For example, consider the following statements:
a = "It was a dark and stormy night."; call change(a, "night", "day"); print a;
The result of these statements is shown in Figure 23.58.
In the old operand, the following characters are reserved:
% $ [ ] { } < > ? * # @ ’ ‘(backquote) ^ |