• 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: Handler works only once
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handler works only once


  • Subject: Re: Handler works only once
  • From: Kai <email@hidden>
  • Date: Mon, 24 Feb 2003 20:54:09 +0000

on 24/2/03 8:18 pm, I wrote:

> on Mon, 24 Feb 2003 08:40:27 -0600, Rich Carroll <email@hidden> wrote:
>
[snip]

>> When repeating thru every item in a value, how do you get the item number?
>> --
>> if charRef's contents is in validChars then
>> set res to res & charRef
>> else if charRef's contents is "." and (charRef's item) is -3 then
>> set res to res & charRef
>
> You really want...

Sorry Rich. It occurs to me that, by offering an alternative method, I
didn't really answer your question at all. This should do the job along the
lines you requested:

=====================================

on stripInvalidChars(txt, validChars)
set {res, chars} to {"", count txt}
repeat with n from 1 to chars
set charRef to txt's item n
if charRef is in validChars then
set res to res & charRef
else if charRef is "." and n is chars - 3 then
set res to res & charRef
end if
end repeat
end stripInvalidChars

=====================================

(This seems to be every bit as fast as the suggestion I posted earlier.)

--
Kai
_______________________________________________
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.

References: 
 >Re: Handler works only once (From: Kai <email@hidden>)

  • Prev by Date: Re: Scripting Mail:get selection
  • Next by Date: Re: Scripting Mail:get selection
  • Previous by thread: Re: Handler works only once
  • Next by thread: Addressing variables in subroutines
  • Index(es):
    • Date
    • Thread