is among the words AND find words

Pete pete at mollysrevenge.com
Wed Dec 21 14:46:01 CST 2011


Plus it doesn't work for the case where the sentence ends with a period and
you search for "men" - that returns zero.


On Wed, Dec 21, 2011 at 12:09 PM, Mark Wieder <mwieder at ahsoftware.net>wrote:

> FlexibleLearning-
>
> Wednesday, December 21, 2011, 12:00:29 PM, you wrote:
>
> > An alternative approach:
>
> > Assuming that the phrase "now is the time, for all good men" is in fld 1,
> > then this button script....
>
> > on mouseUp
> >   put findWord(fld 1,"time")
> > end mouseUp
>
> > function findWord pContent,pStr
> >   if pStr is among the tokens of pContent then
> >     return num of words of char 1 to offset(pStr,pContent) of pContent
> >   else return 0
> > end findWord
>
> > reurns 4 as expected. Similarly for 'time-bomb' and other variants.
>
> Yes, but... if the phrase is "now is the time,for all good men" then a
> search for "all" will return 5 instead of 6.
>
> --
> -Mark Wieder
>  mwieder at ahsoftware.net
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>


More information about the use-livecode mailing list