REPLACE() |
![]() ![]() ![]() |
The REPLACE() function replaces a field, value or subvalue of a dynamic array, returning the result.
Format
REPLACE(dyn.array, field {, value {, subvalue}} , string)
where
If field, value and subvalue are not all present, the comma before the string argument must be replaced by a semicolon.
The statement S = REPLACE(S, F, V, SV, NEW) is equivalent to S<F, V, SV> = NEW
If the specified field, value or subvalue is not present in the dyn.array, mark characters are added and the new item is inserted.
A negative value of field, value or subvalue causes a new field, value or subvalue to be appended. The lower ranking items are taken as being one. For example, S = REPLACE(X, -1, 2, 3, Z) appends a new field. The value and subvalue arguments are treated as though the statement were S = REPLACE(X, -1, 1, 1, Z)
See the description of the S<f,v,sv> assignment operator for a discussion of how QM appends items.
Example
S = REPLACE(REC, 3, 1; ITEM)
This statement assigns S with the result of replacing field 3, value 1 of REC by the contents of ITEM. The value of REC is not changed.
See also: DEL, DELETE(), EXTRACT(), FIND, FINDSTR, INS, INSERT(), LISTINDEX(), LOCATE, LOCATE() |