Finding matched parentheses
dfepstein at comcast.net
dfepstein at comcast.net
Mon Jul 29 10:55:17 EDT 2013
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
More information about the use-livecode
mailing list