When is a quote not a quote?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DanShafer
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 21
Joined: Thu Feb 03, 2011 8:51 pm

When is a quote not a quote?

Post by DanShafer »

I discovered this morning a peculiar behavior with the "quote" constant in LC. This problem is present in 6.6.2 and 6.7 (dp7). I suspect it's been around a while. For all I know, others have documented it.

If you use the command:

find quote in field 3

and are searching a field that contains strings enclosed in double-quotes, you'll find that the find command locates the first quotation mark but fails to find the trailing quotation mark. In a field with multiple strings enclosed in double-quotes, find reliably finds all opening quotes and ignores all closing quotes.

This may be a part of another strange behavior (which I believe *has* been previously reported and discussed): the command "find quote" boxes as found and returns in the foundChunk all of the characters following the quotation mark until it hits the first space (or white space character) or (apparently) punctuation. So if you do a

find quote in field 3

and the string "http:www.foo.bar", the find command boxes "http" as found and returns a 5-character foundChunk value.

I've searched the forums as thoroughly as I can and haven't seen this one discussed, which is somewhat surprising except that I often seem to be doing bizarre stuff nobody else is trying.

This one cost me about two hours today.
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: When is a quote not a quote?

Post by FourthWorld »

Interestingly "find string" seems to do what you're expecting:

find quote in field 3

I never use the find command myself so we'll have to rely on the wisdom of Jacque and others to explain the nuances of its six forms. It may be that this is a bug, or there may be a way this makes sense given the various forms of "find" and how they differ.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10504
Joined: Wed May 06, 2009 2:28 pm

Re: When is a quote not a quote?

Post by dunbarx »

Dan.

This works the same in HC. And Richard's "find string" finds the quote alone there as well. So it is old, old...

Continued finds locate subsequent individual quotes in both.

Craig Newman
Post Reply