arr: array of string;
procedure add(s: string);
begin
SetLength(arr, Length(arr) + 1);
arr[Length(arr) - 1] := s;
end;
procedure remove(s: string); //只能删除第一个符合的
var
i, j: Integer;
begin
for i := 0 to Length(arr) - 1 do begin
if arr[i] = s then begin
for j := i to Length(arr) - 2 do arr[j] := arr[j + 1];
SetLength(arr, Length(arr) - 1);
Break;
end;
end;
end;
procedure removeAt(index: Integer);
var
i: Integer;
begin
if Length(arr) > index then begin
for i := index to Length(arr) - 2 do arr[i] := arr[i + 1];
SetLength(arr, Length(arr) - 1);
end;
end;