paul at researchware.com
Wed Jul 26 21:15:25 EDT 2023
On 7/26/2023 8:00 PM, Mike Kerner via use-livecode wrote:
> actually, i have a couple of questions, which are maybe suggestions,
> but are actually questions, because maybe someone else will be curious
> enough to try to solve them
> * did you check the oss source to see if the function is available?
No. I have little detailed understanding of the open source Livecode
code repository. My minimal understanding is that the engine source is
mostly C++ and my knowledge of C is 30 years out of date. It would be a
bit challenging for me to try to tease out the algorithm charIndex
actually uses. An excellent question and idea though! Kudos!
> * have you messed with using regex to get around the issue?
My regex is a bit better, although I would not consider myself a regex
expert. I had not though of exploring regex for this. I might give that
a try, but if there is a regex expert who sees this that is willing to
weigh on on how you might do this - even just a pointer in the right
direction - that would be helpful. Another great question/idea. Thanks!
charIndex is actually really powerful, if tied to a field object. You
can do thing like "the charIndex of the last character of word 11 to 18
of field X" and it return the character position of the last character
of the last word in the chunk. Of course, if that is what you want, "the
charIndex of char -1 of word 18 of field X" is shorter and does the same
thing. Complex expressions like: the charIndex of word 8 of sentence 3
of paragraph 5 of field X work as expected.
Gosh, I really *love* Livecode Script's chunk expressions! They make
complex text manipulation task so easy!
More information about the use-livecode