Re: Detecting the minus sign in a string
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