Replaces all elements of a list with a specific value by another value.
List.bdh
ListReplaceAll( inout theList: list, in elementFromVal: union, in elementToVal: union) : boolean;
Parameter | Description |
---|---|
theList | List of number, boolean, float or string, which contains elements with value elementToVal instead of elementFromVal as an out parameter. |
elementFromVal | Number, boolean, float or string to be replaced. |
elementToVal | Number, boolean, float or string to replace elementFromVal with. Has to conform with the type of elementFromVal and theList |
transaction TAListReplaceAll var lstNumber: list of number init 111, 2, 3, 111, 2, 3, 111; retVal: boolean; begin retVal := ListReplaceAll(lstNumber, 111, 1); if(retVal) then ListPrint(lstNumber); end; end TAListReplaceAll;
element 1: 1 element 2: 2 element 3: 3 element 4: 1 element 5: 2 element 6: 3 element 7: 1