function AscCompareInt(List: TStringList; I1, I2: Integer): Integer;
begin
I1 := StrToIntDef(List[I1], 0);
I2 := StrToIntDef(List[I2], 0);
Result := I1 - I2; //正序排序
end;
function DescCompareInt(List: TStringList; I1, I2: Integer): Integer;
begin
I1 := StrToIntDef(List[I1], 0);
I2 := StrToIntDef(List[I2], 0);
Result := I2 - I1; //倒叙排序
end;
//调用代码:
vStrList.Sorted:=False;
vStrList.CustomSort(AscCompareInt); //正序排序
vStrList.CustomSort(DescCompareInt);//倒叙排序