Previous Thread
Next Thread
Print Thread
xcall TRIM issue #37232 27 Mar 24 02:39 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
Hi,

We have found what we believe is an issue in xcall TRIM. It looks like it is trimming non-printable characters even if the second parameter is not specified.

Code
build'str$ = CHR(20)
build'str$ += CHR(30)
Trace.Print "Built String:" + ASC(build'str$[1;1]) + "," + ASC(build'str$[2;1])

XCALL TRIM, build'str$
Trace.Print "TRIM Value:" + ASC(build'str$[1;1]) + "," + ASC(build'str$[2;1])

build'str$ = CHR(20)
build'str$ += CHR(30)
XCALL TRIM, build'str$, 1
Trace.Print "TRIM Value, 1:" + ASC(build'str$[1;1]) + "," + ASC(build'str$[2;1])


EL7: 7.0.1756.2

Credit goes to our friend Kyle for this find and example program.

Thanks,
John

Re: xcall TRIM issue [Re: John Andreasen] #37233 27 Mar 24 04:01 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
I thought that bug was fixed in 1754.1, but apparently not (or not completely). I'm on the road today but will get to the bottom of it tonight or tomorrow.

Re: xcall TRIM issue [Re: John Andreasen] #37234 27 Mar 24 11:53 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
OK, thanks Jack

Re: xcall TRIM issue [Re: John Andreasen] #37235 28 Mar 24 01:45 AM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
Either I had been out in the sun too long before my response earlier today, or I've been on the road too long now. But if I'm not mistaken, isn't it working the way it is documented . The output for the test program is:
Code
Built String:20,30
TRIM Value:20,30
TRIM Value, 1:0,0

So in other words, with a string consisting of two control characters (chr(20) plus a chr(30))...

XCALL TRIM, build'string$ leaves it alone (since in that mode, it should only remove spaces).
XCALL TRIM, build'string, 1 however teats the control characters the same as if they were spaces, i.e. removes them.

Note that in 1754.0, the rewrite of STRIP and TRIM did result in a bug like the one you describe. But I think it was fixed in 1754.1. Perhaps there was some mixup and it crept back in to 1756.2, but it seems to be working as documented in the latest, 7.0.1757.1, which you can download from the following:

ash-7.0.1757.1-el7-upd.tz
ash70notes.txt

Re: xcall TRIM issue [Re: John Andreasen] #37238 28 Mar 24 03:26 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
Hi Jack,

OK, thanks for checking into it. We will try the latest and verify it fixes it for us.

Thanks,
John


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3