sentences as items
Jim Hurley
jhurley at infostations.com
Thu Mar 6 15:31:00 EST 2003
>
>Message: 6
>Date: Thu, 6 Mar 2003 16:19:01 +0100
>Subject: sentences as items
>From: Toma Tasovac <ttasovac at princeton.edu>
>To: use-revolution at lists.runrev.com
>Reply-To: use-revolution at lists.runrev.com
>
>How can I make Revolution count each sentence in a field as an item --
>so that I can then easily manipulate whole sentences as item 1, item 2
>etc. In other words is there a magical way to make several characters
>("." "?" "!") count as the same itemDelimiter?
>
>All best,
>Toma
>
>
Toma,
I'm not sure what kind of manipulation you had in mind but as an
example of what you might try, the mouseUp handler below will
interchange sentences 3 and 5 in text in which all sentences end in
.,? or !
It's not pretty. It puts a new delimiter at the end of each sentence,
does the manipulation and then deletes the delimiter.
On mouseUP
put "*" into tChar --Or some less likely character
put field 1 into tText
put addDelimiter(tText,tChar) into tText
put interchangeSentences(3,5,tText,tChar)into tText
replace tChar with "" in tText
put tText into field 2
end mouseUP
function addDelimiter temp,tChar
replace "." with "." & tChar in temp
replace "?" with "?" & tChar in temp
replace "!" with "!" & tChar in temp
return temp
end addDelimiter
function interchangeSentences n,m,theText,tChar
set the itemdelimiter to tChar
put item n of theText into temp
put item m of theText into item n of theText
put temp into item m of theText
return theText
end interchangeSentences
Hope this gives you some ideas.
Jim
More information about the use-livecode
mailing list