• 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: "starts with" any list item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "starts with" any list item


  • Subject: Re: "starts with" any list item
  • From: John Stewart <email@hidden>
  • Date: Mon, 29 Sep 2003 18:21:28 -0400

On 9/29/03 at -0700 Paul Berkowitz said this

>On 9/29/03 8:35 AM, "Paul Berkowitz" <email@hidden> wrote:
>
>>
>>> Or do I need to loop through the list incrementally?
>>
>> Yes. Unless they're all the same length - then you could say
>>
>> if {text 1 thru 5 of clippingTitle} is in {"ASCII", "Index",
>"http:"}
>
>And even then you'd need a try/error block since clippingTitle might be
>short than 5 characters and would error here.


Using "text 1 thru x of clippingTitle" isn't really what you would want here anyway, try -

set clippingTitle to "Wow, A Treatise on the Structural Engineering of Thong Bikinis"
set wrdLst to {"ASCII", "Index", "http", "Wow"}
set wrd1 to first word of clippingTitle

if wrd1 is in wrdLst then
say wrd1
else
say "There isn't any!"
end if

This should work most of the time. The advantage of "word" is that it isn't length specific.

You would still need to add some error checking to handle anything not covered by the above.

John
_______________________________________________
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: "starts with" any list item (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Writing To A File
  • Next by Date: RE: a script object (class) as a member of another script
  • Previous by thread: Re: "starts with" any list item
  • Next by thread: Re: "starts with" any list item
  • Index(es):
    • Date
    • Thread