• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie. How do I count "i"?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie. How do I count "i"?


  • Subject: Re: Newbie. How do I count "i"?
  • From: email@hidden (Michael Sullivan)
  • Date: Sun, 27 Jan 2002 12:52:43 -0500
  • Organization: Society for the Incurably Pompous

John Baxter writes:

> That's probably what I would do (for case sensitive). But...regardless of
> method, one's test case should include some double (or longer) i sequences.
> And strings with leading and trailing i characters. Encouragingly, the
> string "iixyzii" counts to 4 (as it should) using the TID method. But that
> one string isn't a full test by any means.

It's not, but I've done a lot of testing of TIDs in this way, and so far
it's been completely consistent that a string with two delimiters in a
row gets represented as having an item of "" in the list produced, and
strings which start with the delimiter or end with a delimiter have an
empty string at the beginning or end as required.

I believe this method is safe, and very likely to be the fastest one
available.

The only problem with it is if you have long strings with possibly very
many instances (over 4000 or so) of the delimiter, in which case it can
generate a stack overflow. The solution there would be an algorithm to
break down strings into sufficiently small chunks and then work on the
chunks one by one. I have a GroupTheString handler I wrote in response
to a question about such chunking on the list a few months ago, and I
can send it if the original poster wants it. I think has or someone
might have put a similar handler up on Applemods already (If not, I'll
eventually submit mine).


Michael


References: 
 >Re: Newbie. How do I count "i"? (From: John W Baxter <email@hidden>)

  • Prev by Date: Re: GC Scale- 0ff topic
  • Next by Date: Re: Close Access
  • Previous by thread: Re: Newbie. How do I count "i"?
  • Next by thread: Re: Newbie. How do I count "i"?
  • Index(es):
    • Date
    • Thread