Interesting wordOffset behavior
Peter Haworth
pete at lcsql.com
Mon Dec 3 15:36:39 EST 2012
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 <http://www.lcsql.com>
More information about the use-livecode
mailing list