[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Re: Replacing single quote with two single quotes



aha! reading the release notes eh!
Not much on TV
Steve  ;-)

-----Original Message-----
From: sqr-users-admin@sqrug.org [mailto:sqr-users-admin@sqrug.org]On
Behalf Of Nathan Stratton Treadway
Sent: Thursday, 12 February 2004 1:45 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] Re: Replacing single quote with two single quotes


On Wed, Feb 11, 2004 at 07:30:29PM +1100, Steve Cavill wrote:
> Looks like there's a bug in v6:
>
> The problem is the surrounding quotes, combined with replace.
>
> This works in 6.2.1:
> let $namefirstQ =   replace($namefirst,$Quote,$twoquotes)
>  let $namefirstQ= ''''|| $namefirstQ || ''''
>
> but this crashes:
> let $namefirstQ =  '''' || replace($namefirst,$Quote,$twoquotes) || ''''

More generally, there seems to be a problem if the REPLACE operation is
used inside a more complex expression, and the "old" and "new" strings
aren't the same size.

So, these seem to work:
  let $test = 'Test ' || replace('ABC','A','1')
  let $test = replace('ABC','A','12')
but this will seg fault:
  let $test = 'Test ' || replace('ABC','A','12')
and this produces the wrong output  ("12BC1 1BCTest" instead of
"12BCTest"):
  let $test = replace('ABC','A','12') || 'Test'


As far as I can tell, the workaround you found (putting the REPLACE in
its own LET statement) does work correctly in all situations.


> Both work fine in sqr 8.1

The release notes for v8.0 include this note: "13310 The SQR LET function
REPLACE() now works properly in all cases."

                                                        Nathan
----------------------------------------------------------------------------
Nathan Stratton Treadway  -  nathanst@ontko.com  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users