text parsing question
Phil Davis
davis.phil at comcast.net
Fri Jun 9 17:16:44 EDT 2006
Don't know about *the* cool way, but here's one way that works, Josh:
-- assumptions:
-- fld 1 = unparsed text
-- fld 2 = parsed text
on mouseUp
put fld 1 into tList
put empty into tNewList
repeat for each line tLine in tList
set the itemDelimiter to ";"
put pixelCount(item 2 of tLine) \
&& pixelCount(item 3 of tLine) \
&& pixelCount(item 4 of tLine) \
&& pixelCount(item 5 of tLine) \
after tNewList
set the itemDelimiter to quote
put space & item 6 of tLine & cr after tNewList
end repeat
delete last char of tNewList
put tNewList into fld 2
end mouseUp
function pixelCount pData
set the itemDelimiter to colon
get item 2 of pData
repeat until first char of it is a number
delete first char of it
end repeat
repeat until last char of it is a number
delete last char of it
end repeat
return it
end pixelCount
HTH -
Phil Davis
Josh Mellicker wrote:
> You have a series of lines, like this:
>
>
> <div id="go" style="position:absolute; left:468px; top:43px;width:
> 112px; height:110px;z-index:1; visibility:visible"><img src="images/
> go.png" width="112" height="110" border="0"></div>
>
>
> All you want out of this line is:
>
> 468 43 112 110 images/go.png
>
>
> What is the cool way to write a function to extract these strings?
More information about the use-livecode
mailing list