Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-07

A good array sorting unit?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Lang

Under DOS, I used the wonderful TpSort unit of Turbo Professional to sort stuff. Does anybody here know of a unit, which works under Free Pascal and has similar features. I need to sort arrays and I'd like to be able to give the sorting algorithm the address of a function, which I can write on my own, and which is then used by the sorting function to do the trick. This works great with TpSort. For instance with TpSort, I can write a function which sorts using several fields of the array (first by name, then by date) etc.

Thanks

<*** Michael Lang ***>

Michael Van Canneyt
to Michael Lang
Michael Lang wrote 8 lines
Under DOS, I used the wonderful TpSort unit of Turbo Professional to sort stuff. Does anybody here know of a unit, which works under Free Pascal and has similar features. I need to sort arrays and I'd like to be able to give the sorting algorithm the address of a function, which I can write on my own, and which is then used by the sorting function to do the trick. This works great with TpSort. For instance with TpSort, I can write a function which sorts using several fields of the array (first by name, then by date) etc.

The TStringList class of the FCL (unit classes) supports a custom sort algorithm; (By default, QuickSort is used.) this can be used to make an optimal sort for the data you're using.

Michael.