Word chunk includes punctuation

James Hale james at thehales.id.au
Mon Aug 13 11:10:57 EDT 2012


I haven't noticed this before but getting the word chunk of some text returns punctuation with the chunk.

For example, consider the following string:
     "My this is a nice, albeit short test. But it will do."

Now if I ask for word 4 I get "a" as expected.
If is ask for word 5 I get "nice," which is not what I expected.
Why have I got a comma included with the word.

So if I ask for "the length of word 5" I get a 5 returned instead of the correct length, 4.

I can't believe this is what is supposed to happen.
I can't believe no one has commented on this before.

Is this a bug?
If not, has anyone got a workaround that doesn't require me testing for a punctuation character at the end of every word or replacing them all with spaces?

James





More information about the use-livecode mailing list