What should the trim function do? It seems to me that under gpc it removes trailing spaces from a string. Under Delphi it removes leading and trailing spaces. Unfortunately I don't have any Turbo Pascal documentation to hand (I assume trim is a Borlandism).
BP doesn't have it afaik, but a lot of 3rd party addons have it.
There must be a hundred versions of a TP Trim out there :-)