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: 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