• 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: Detecting the minus sign in a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting the minus sign in a string


  • Subject: Re: Detecting the minus sign in a string
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 23 Jun 2010 12:22:07 -0700

On Jun 23, 2010, at 11:36 AM, Alex Zavatone wrote:

Well, specifically, I'm trying to see if the minus sign is the second word from the end of a string. 

that makes it easy, assuming that there's at least one hyphen in the string.

set text item delimiters to {"-"}
set mystring to "This is - my - string"
if (count words of last text item of mystring) is 1 then
true
else
false
end if

This returns true if the last of more than one hyphens is the last word of the string.

You would need error correction for zero hyphens.  There may, however, be a problem depending on how you are defining "word"; would any other non-alphanumeric be considered a word, or exist after the last hyphen?

-- Michelle

-- 
"Life is too cool to miss."
-- Sammy Camarata

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Detecting the minus sign in a string
      • From: Alex Zavatone <email@hidden>
    • Re: Detecting the minus sign in a string
      • From: Tommy Bollman <email@hidden>
References: 
 >Detecting the minus sign in a string (From: Alex Zavatone <email@hidden>)
 >Re: Detecting the minus sign in a string (From: Michelle Steiner <email@hidden>)
 >Re: Detecting the minus sign in a string (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Detecting the minus sign in a string
  • Next by Date: Re: Detecting the minus sign in a string
  • Previous by thread: Re: Detecting the minus sign in a string
  • Next by thread: Re: Detecting the minus sign in a string
  • Index(es):
    • Date
    • Thread