A-Shell Network

xcall TRIM issue

Posted By: John Andreasen

xcall TRIM issue - 27 Mar 24 02:39 PM

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
Posted By: Jack McGregor

Re: xcall TRIM issue - 27 Mar 24 04:01 PM

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.
Posted By: John Andreasen

Re: xcall TRIM issue - 27 Mar 24 11:53 PM

OK, thanks Jack
Posted By: Jack McGregor

Re: xcall TRIM issue - 28 Mar 24 01:45 AM

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
Posted By: John Andreasen

Re: xcall TRIM issue - 28 Mar 24 03:26 PM

Hi Jack,

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

Thanks,
John
© 2024 A-Shell Forum