is among the words AND find words

Phil Davis revdev at pdslabs.net
Wed Dec 21 00:41:28 EST 2011


Hi Jim,

Try "token" instead of "word" as the chunk you're looking for. It will work.

On 12/20/11 4:42 PM, Jim Hurley wrote:
> If the sentence:
>
>    "Now is the time, for all good men."
>
> is within the field "myField" , then
>
>     find word "time" in field "myField"
>
> is successful. The word "time" is found despite the fact that it is not delimited with spaces on either side.
>
> But
>
>     "time" is among the words of "Now is the time, for all good men."
>
> returns false, since "is among the words" reads the comma after "time".  It requires the spaces on either side of "time" as delimiters.

But
         "time" is among the tokens of "Now is the time, for all good men."

returns true. Unfortunately you will have to write your own tokenOffset() 
function.  :-)

Phil Davis

>
> Has this come up before and has it been suggest that this be an enhancement?
>
> That is to say, it would be helpful if "is among the words" and "find word(s)" behave the same with respect to the space delimiter.
>
> Or am I missing something?
>
> Jim Hurley
> _______________________________________________
> 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
>

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net





More information about the use-livecode mailing list