• 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: checking for characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checking for characters


  • Subject: Re: checking for characters
  • From: David Hood <email@hidden>
  • Date: Wed, 10 Sep 2003 17:03:47 +1200

This will identify if there is at least one . in a string by checking how many groups the string (excluding the first and last character) will fall into if you divide the string up with .s

set testString to ".weird.case." -- example string
set newtest to (characters 2 through -2 of testString) as string
set AppleScript's text item delimiters to "."
set the listOftextitems to every text item of newtest
set numberOfparts to count of listOftextitems
set AppleScript's text item delimiters to ""
if numberOfparts = 1 then
--does not have . in middle
else
--has . in middle
end if

There can be anything before and after the .

David Hood
_______________________________________________
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: checking for characters (From: Tait Sanders <email@hidden>)

  • Prev by Date: Re: Dates gone wild
  • Next by Date: Re: iCal & AppleScript
  • Previous by thread: Re: checking for characters
  • Next by thread: Re: checking for characters
  • Index(es):
    • Date
    • Thread