problem with counting words

Richard Gaskin ambassador at fourthworld.com
Tue Oct 14 16:44:21 EDT 2014


dunbarx wrote:

> Right, and I am sure you know this, but it was never particularly a speed
> issue,rather  more a mental and organizational one, that would be even
> more opaque if you had, say a handful of nested delimiters instead of just
> two.

The speed info I provided wasn't to show that it's fast, but merely that 
it's not too slow to be used right now.

I'll bet with v8's Open Language there would be a way to expand the 
syntax to make it more xTalk-like, but if anyone here actually needs to 
work on data with n-depth items this function seems to work well enough 
to get the job done.


> -----Original Message-----
...
> If that would be fast enough for your needs, you could write a function
> that takes any number of item number/delimiter pairs as arguments,
> following the data itself:
>
> on mouseUp
>     put 1000 into n
>     put "aaa,bbb,ccc#ddd#eee#fff,ggg,hhh" into tSomeData
>     --
>     put the millisecs into t
>     repeat n
>        get nDepth(tSomeData, 3, comma, 2, "#" )
>     end repeat
>     put the millisecs - t into t1
>     put t1/n &cr& it
> end mouseUp
>
> function nDepth
>     get param(1)
>     repeat with i = 2 to paramCount() step 2
>        set the itemDel to param(i+1)
>        get item param(i) of it
>     end repeat
>     return it
> end nDepth


-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list