Interesting wordOffset behavior

Mark Schonewille m.schonewille at
Mon Dec 3 14:39:32 CST 2012

Hi Pete,

It will return 0 if you set the wholeMatches to true.

Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces.

We have time for new software development projects. Contact me for a quote.

On 3 dec 2012, at 21:36, Peter Haworth wrote:

> I'm finding that wordOffset treats comment chars as a word even if they
> are immediately followed by another character.
> For example:
> wordOffset("--","repeat with x=1 to 100 --check something")
> ...returns 6.  I would have expected it to return zero since there is
> no occurrence of "--" surrounded by spaces or quotes.
> To add to the plot:
> put word 6 of "repeat with x=1 to 100 --check something"
> ...returns "--check"
> And:
> wordOffset("--","repeat with x=1 to 100 -- check something")
> ...also returns 6 (there's a space between the comment chars and "check" in
> this example).
> It turns out that this is useful in the context of what I'm doing but
> whenever I run into what I think is unexpected behavior like this, I'm wary
> of using it in case it's actually a bug that might get fixed at some point
> and break my code.
> Am I being over cautious?
> Pete
> lcSQL Software <>

More information about the use-livecode mailing list