Finding the line where a word appears

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Finding the line where a word appears

Post by Andycal » Sun Jun 15, 2008 11:15 pm

Just getting used to the text processing in Rev (thanks for the last bit of help!)

So, I've gone a bit crazy and downloaded a thesaurus (I'm playing with one of the example text editors from RevOnline). The thesaurus is just a comma seperated list with <CR><LF> between each line of similar words.

What I want to do is search for a word and then put the entire line that the word appears in into a field (i.e. the synonyms). So, if I search for a word, how do I return what line that word appears in?

I guess it's something like :

-search for the word
-put line number into a variable (x)

-put line x into fld "synonyms"

Am I close?

TEDennis
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 41
Joined: Tue Apr 11, 2006 12:36 am

Post by TEDennis » Mon Jun 16, 2008 12:18 am

Try this -- all in one statement:

[code]put line lineOffset("WordToFind", theThesaurus) of theThesaurus into field "Synonyms"[/code]

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Mon Jun 16, 2008 7:05 am

TEDennis wrote:Try this -- all in one statement:

Code: Select all

put line lineOffset("WordToFind", theThesaurus) of theThesaurus into field "Synonyms"
Wonderful, works a treat!

Post Reply