Hi,
During some tests I ran with gpc 2050331 to evaluate the gap between SUN and GNU Pascal, I discovered that the function TRIM() is broken when it is passed a packed array of char.
The small program bellow shows incorrect result:
PROGRAM Trim; VAR St : PACKED ARRAY [1..20] OF CHAR; I : INTEGER; BEGIN WriteLn('Before assignment:'); FOR I := 1 TO 20 DO WriteLn('St[', i:2,']=', Ord(St[i])); { This shows a series of 0 } WriteLn('After assignment:'); St := 'The String'; FOR I := 1 TO 20 DO WriteLn('St[', i:2,']=', Ord(St[i])); { This shows the string padded with blanks (CHR(32)} St := Trim(St); WriteLn('After Trim:'); FOR I := 1 TO 20 DO WriteLn('St[', i:2,']=', Ord(St[i])); { ***This shows the string exactly AS BEFORE! } END.
Am I right when I think the function TRIM should replace the blanks with some CHR(0)?
Thanks
Pascal Viandier