Chopping Up A Paragraph into chunks

John Patten johnpatten at mac.com
Tue Jan 25 19:20:22 EST 2011


Hi All...

I'm trying to divide a paragraph into random chunks, but I'm not quite  
sure how to do it.

Here's what I'm thinking:

put the text of cd fld "paragraphContainer" into tParagraph
   put the number of words in tParagraph into tWordCount
    put random(10) into tRandomGroup --determineshow many words per  
chunk
   put tWordCount/tRandomGroup into tNumberOfWordsInChunk  --I know I  
could have a decimal, but I'll deal with that later...
    put 0 into x
    repeat until number of words in cd fld "paragraphContainer" = 0  -- 
Not sure this is possible?
        create field
       set the loc of last fld to (x+5,150) -- stepping the location  
of each new field over 5 pixels
       select first tRandomGroup words of cd fld "paragraphContainer"  
-- planning to cut selected words from field and just repeat until all  
words are cut from field
       cut selectedText
       paste into last cd fld
       add 5 to x
    end repeat


Would it be better to put all the chunks in an array first, and then  
pull them out of the array in chunks?

Ultimately just trying to get a group of new fields consisting of  
chunks of text from the main paragraph.

Thank you!

John Patten
SUSD



More information about the use-livecode mailing list