Finding matched parentheses
dunbarx at aol.com
dunbarx at aol.com
Mon Jul 29 12:07:53 EDT 2013
Hi.
I tired your script on the string:
aa(ss)(xx)(yy)
it only returned the parens bracketing "ss"
Craig Newman
-----Original Message-----
From: dfepstein <dfepstein at comcast.net>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Mon, Jul 29, 2013 10:56 am
Subject: Re: Finding matched parentheses
On second thought :
function offsetPair a,b,str -- str cannot be more than one line
-- returns first instance of char a && "matching" instance of char b in str,
or 0 if no a or empty if no match
put offset(a,str) into ca
if ca = 0 then return 0
put numToChar(7) into char 1 to ca of str
set lineDelimiter to a
set itemDelimiter to b
repeat with i = 1 to the number of items in str
if i = the number of lines in item 1 to i of str then return ca &&
ca+length(item 1 to i of str)
end repeat
return empty
end offsetPair
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list