http://www.cnblogs.com/del/archive/2007/12/10/990040.html

//排序与倒排序
{排序函数} function DescCompareStrings(List: TStringList; Index1, Index2: Integer): Integer; begin   Result := -AnsiCompareText(List[Index1], List[Index2]); end; procedure TForm1.Button1Click(Sender: TObject); var   List: TStringList; begin   List := TStringList.Create;   List.Add('bbb');   List.Add('ccc');   List.Add('aaa');   //未排序   ShowMessage(List.Text);  //bbb ccc aaa   //排序   List.Sort;   ShowMessage(List.Text);  //aaa bbb ccc   //倒排序   List.CustomSort(DescCompareStrings);  //调用排序函数   ShowMessage(List.Text);  //ccc bbb aaa   //假如:   List.Sorted := True;   List.Add('999');   List.Add('000');   List.Add('zzz');   ShowMessage(List.Text);  //000 999 aaa bbb ccc zzz end;