shilling for my feature request [1926]
Jeanne A. E. DeVoto
revolution at jaedworks.com
Sun Aug 22 15:56:54 EDT 2004
At 10:27 AM -0700 8/20/2004, Mark Brownell wrote:
>I finally found what I was looking for in the basic core for all my
>pull-parser needs. With the help of those at Run Rev this was found:
>>So, one idea is to implement a function:
>> matchGlobal(stringToSearch, token)
>>returning a list of all indices in stringToSearch of token.
>>
>>e.g.
>> get matchGlobal("<a>foo</a><a>bar</a><a>baz</a>", "<a>")
>>would give
>> it[1] = 1
>> it[2] = 10
>> it[3] = 20
The functionality sounds good, but may I put in a vote for readable
syntax, instead of this C-like horror? ;-) For example, this one has
been discussed pretty extensively on the Xtalk list:
get the offsets of "<a>" in "<a>foo</a><a>bar</a><a>baz</a>"
returning either the array as above (although I'm a bit allergic to
arrays in cases where they're not absolutely needed - difficult to
display for debugging, etc.), or, as in most return values, a simple
comma-delimited list: 1,10,20.
There are some advantages, since "offset" already exists and so
"offsets" leverages off developer knowledge of that function. The
syntax is also cleaner than the existing "offset" syntax, which has
been a rough spot ever since HyperTalk 1.0, so making the obvious
extension to the offset function might not be a bad idea. This could
also be extended to word offsets, item offsets, and line offsets
matching the current "offset" function variants.
--
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com
More information about the use-livecode
mailing list