Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Replaces ALL oldValues items in TIA with newValue.
- [==============================================================================}
- procedure TIAReplace(var TIA: TIntArray; oldValues: TIntArray; newValue: Integer);
- var
- h, i: Integer;
- begin
- h := High(TIA);
- if ((h > -1) and (High(oldValues) > -1)) then
- for i := 0 to h do
- if TIAContains(oldValues, TIA[i]) then
- TIA[i] := newValue;
- end;
- var
- TIA: TIntArray;
- begin
- TIA := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- WriteLn('Before: ' + TIAToStr(TIA));
- TIAReplace(TIA, [2, 4, 6, 8], 0);
- WriteLn('After: ' + TIAToStr(TIA));
- SetLength(TIA, 0);
- end.
Advertisement
Add Comment
Please, Sign In to add comment