• 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: Wierd error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wierd error


  • Subject: Re: Wierd error
  • From: "Arthur J. Knapp" <email@hidden>
  • Date: Wed, 24 Sep 2003 10:20:53 -0400

> Subject: Re: Wierd error
> Date: Wed, 24 Sep 2003 02:50:17 +0100
> From: Nigel Garvey <email@hidden>

> And don't forget 'considering case', arranging the most likely characters
> towards the beginning of the 'valids' string, and only counting
> 'inputtext' once. As a safety feature, the whole process could go in a
> 'try' block with the first repeat going up to (count inputtext) + 1. If i
> gets that far, it means there are no valid characters in inputtext and
> the attempt to test beyond the end of the string will cause an error.
> 'trimmedText' can then be set to "" in the 'on error' block.

Gordon Hartley-Bennett...! You're a raving genius!!! ;-)

- "considering case" speeds up text comparisons considerably.

- arranging the most frequently occuring letters first also
speeds things up, as Nigel and I have worked out in the past.

- placing any static value that is need more than once into a
variable, like "count inputtext," is always a good idea.

- a try-statement to handle out of bounds is often a nice way
to avoid repeatedly checking the lengths of strings.

When all is said and done, we might save a good 100 whole milliseconds!!!
(Which, of course, is 0.1 of a second). ;-)


{ Arthur Knapp, of <http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m

"Love is like oxygen..."
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Getting the time of day
  • Next by Date: Re: Image thumbnails question
  • Previous by thread: Re: Wierd error
  • Next by thread: Re: Wierd error
  • Index(es):
    • Date
    • Thread