problem with counting words

dunbarx at aol.com dunbarx at aol.com
Tue Oct 14 14:44:58 EDT 2014


Pete. 


I think we are on the same page. Your code would have unpacked with each item as (returns just for clarity):


a
1,b
2,c
3


Probably your point is that this is not what was intended.


Your loop example is just like the sort of thing that started this. The intent was to be able to, given tData:


aaa,bbb,ccc#ddd#eee#fff,ggg,hhh


get item 2 to 3 delimited by "#" of item 3 of tData


would return:


ddd#eee


Craig







-----Original Message-----
From: Peter Haworth <pete at lcsql.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Oct 14, 2014 12:59 pm
Subject: Re: problem with counting words


Yeah, I don't think word was considered during the discussion.

Multiple delimiters might be a good idea but it feels like you'd have to
know which delimiter had been encountered.  For example, if you had a
string like this:

a=1,b=2,c=3

and you wanted to unpack it with:

repeat for each item ritem delimited by "=,"
  doStuff
end repeat

You'd probably need to know which delimiter had been encountered to
distinguish between the left and right sides of the "=" character.

The main intent behind "delimited by" was to do away with having to keep
resetting the itemdelimiter, e.g

repeat for each item rItem1 delimited by "="
   <do stuff with ritem1>
   repeat for each item rItem2 delimited by ","
      <do stuff with ritem2>
   end repeat
end repeat

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Tue, Oct 14, 2014 at 9:31 AM, Ralph DiMola <rdimola at evergreeninfo.net>
wrote:

> That would be a great enhancement. +1 A collection of delimiters(item
> list?)
> would be needed to even emulate the current word chunk.
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdimola at evergreeninfo.net
>
> -----Original Message-----
> From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On
> Behalf
> Of Peter Haworth
> Sent: Tuesday, October 14, 2014 11:32 AM
> To: How to use LiveCode
> Subject: Re: problem with counting words
>
> On Tue, Oct 14, 2014 at 12:45 AM, Kay C Lan <lan.kc.macmail at gmail.com>
> wrote:
>
> > If you want something new... a chunk, then the ability to specify it's
> > delimiter as a range of characters that are either single of combined
> > *could* be a valid enhancement.
> >
>
> Rather than try to explain the thinking behind "delimited by", I'll refer
> you to the forum discussion at
>
> http://forums.livecode.com/viewtopic.php?f=6&t=21630&p=111222&hilit=delimite
> d+by#p111222
> and
> enhancement request at http://quality.runrev.com/show_bug.cgi?id=13557.
>
> Pete
> lcSQL Software <http://www.lcsql.com>
> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
> SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list