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).
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 :-)
Marco van de Voort wrote:
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 :-)
A pre-historical note: The built-in 'add ons':- TRIM - remove trailing blanks LTRIM - remove leading blanks
have always existed in Pascal/VS and then VS/Pascal - IBM mainframe implementation - very old....
John
John P.R. Archer wrote:
A pre-historical note: The built-in 'add ons':- TRIM - remove trailing blanks LTRIM - remove leading blanks
have always existed in Pascal/VS and then VS/Pascal - IBM mainframe implementation - very old....
GPC has Trim{Left,Right,Both}Str as functions and Trim{Left,Right,Both} as procedures in the GPC unit (besides the built-in Trim). I can add LTrim as a synonym for TrimLeftStr in the unit.
Frank
Frank,
I am happy with them as they are - I was simply pointing out that TRIM already existed in dialects of Pascal when Turbo Pascal etc. were just a twinkles in someone's eye. As I said, a pre-historical note!
Cheerio for now, John
Frank Heckenbach wrote:
John P.R. Archer wrote:
A pre-historical note: The built-in 'add ons':- TRIM - remove trailing blanks LTRIM - remove leading blanks
have always existed in Pascal/VS and then VS/Pascal - IBM mainframe implementation - very old....
GPC has Trim{Left,Right,Both}Str as functions and Trim{Left,Right,Both} as procedures in the GPC unit (besides the built-in Trim). I can add LTrim as a synonym for TrimLeftStr in the unit.
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
Martin Liddle wrote:
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).
Nope, it's EP (6.7.6.7), and the correct behaviour is indeed to remove only trailing spaces.
Since it's only a built-in function, not a keyword, it's easy to overload it in a Delphi compatibility unit if someone wants Delphi's incorrect behaviour ...
Frank
On 13 Dec 2001, at 1:41, Frank Heckenbach wrote:
Martin Liddle wrote:
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).
Nope, it's EP (6.7.6.7), and the correct behaviour is indeed to remove only trailing spaces.
Since it's only a built-in function, not a keyword, it's easy to overload it in a Delphi compatibility unit if someone wants Delphi's incorrect behaviour ...
This is done in the GPC "sysutils" unit. You can download this from; ftp://agnes.dida.physik.uni-essen.de/home/chief/sysutils/
Best regards, The Chief --------- Prof. Abimbola Olowofoyeku (The African Chief) Author of Chief's Installer Pro for Win32 Email: African_Chief@bigfoot.com http://www.bigfoot.com/~african_chief/
In article 200112130041.BAA01865@goedel.fjf.gnu.de, Frank Heckenbach frank@g-n-u.de writes
Martin Liddle wrote:
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).
Nope, it's EP (6.7.6.7), and the correct behaviour is indeed to remove only trailing spaces.
Since it's only a built-in function, not a keyword, it's easy to overload it in a Delphi compatibility unit if someone wants Delphi's incorrect behaviour ...
Thanks for the clarification (and to the other posters).
For the record, I have built 20011202 and compiler our application without any obvious problems. Well done to all concerned.