如果不是Insert到最后一项,就会移动(Count - Index)项索引:
procedure TStringList.InsertItem(Index: Integer;
const S: string;
AObject: TObject);
begin
Changing;
if FCount = FCapacity then
Grow;
if Index < FCount then
System.Move(FList^[Index], FList^[Index + 1],
(FCount - Index) * SizeOf(TStringItem));
with FList^[Index]do
begin
Pointer(FString) := nil;
FObject := AObject;
FString := S;
end;
Inc(FCount);
Changed;
end;