• 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: KOENIG Yvan <email@hidden>
  • Date: Wed, 23 Jun 2010 22:52:42 +0200


Le 23 juin 2010 à 20:36, Alex Zavatone a écrit :


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


As a minus character is definitely not a word, it seems that in fact you want to check if there is such a char before the last word of your string.

So this code may be helpful.

--=====

set mon_texte to "This is my - string"
set en_liste to my decoupe(mon_texte, "-")
if (count of en_liste) is 1 or (count words of (last item of en_liste)) > 1 then
set |la_réponse| to false
else
set |la_réponse| to true
end if


--=====

on decoupe(t, d)
	local oTIDs, l
	set oTIDs to AppleScript's text item delimiters
	set AppleScript's text item delimiters to d
	set l to text items of t
	set AppleScript's text item delimiters to oTIDs
	return l
end decoupe

--=====

Yvan KOENIG (VALLAURIS, France) mercredi 23 juin 2010 22:52:08



_______________________________________________
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
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: System Events: window id's instead of window names?
  • 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