Deutsch   English   Français   Italiano  
<ttpqam$7tm$1@shakotay.alphanet.ch>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!news.alphanet.ch!alphanet.ch!.POSTED!not-for-mail
From: "M.V." <mv@gmail.com.invalid>
Newsgroups: fr.comp.lang.regexp,fr.comp.sys.mac.programmation
Subject: Re: Verifier la presence d'un mot dans tous les champs
Followup-To: fr.comp.sys.mac.programmation
Date: Thu, 2 Mar 2023 09:29:58 -0000 (UTC)
Organization: M.V. & Co
Archive: no
Message-ID: <ttpqam$7tm$1@shakotay.alphanet.ch>
References: <t0lcik$1616$1@cabale.usenet-fr.net>
 <dg1u2h9ms324so97iqqac5jfclhunbt5u0@4ax.com> <t0n2vh$23a2$1@cabale.usenet-fr.net>
 <t8162d$1rbm$1@gioia.aioe.org> <t81ks1$2ipl$1@cabale.usenet-fr.net>
 <ttkveo$7no$1@shakotay.alphanet.ch> <ttl07l$u8m$1@cabale.usenet-fr.net>
 <ttl3bh$svv$1@shakotay.alphanet.ch> <ttm19j$1bll$1@cabale.usenet-fr.net>
 <ttm1u5$1br0$1@cabale.usenet-fr.net> <ttm4os$inu$1@shakotay.alphanet.ch>
 <1q6wq7l.wkh7dy1ty8eazN%andre_favre@af.invalid>
 <ttn9em$h0s$1@shakotay.alphanet.ch>
Reply-To: michel.vauquois@gmail.com
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 2 Mar 2023 09:29:58 -0000 (UTC)
Injection-Info: shakotay.alphanet.ch; posting-account="michelvauquois";
	logging-data="8118"; mail-complaints-to="usenet@alphanet.ch"; posting-host="961b1d675b4792ec2ef50fdab1e0d2ea.nnrp.alphanet.ch"
User-Agent: MacCafe/2.11/caturra (Mac OS X 10.14.6 (18G9323) - MacBookAir7,2)
Cancel-Lock: sha1:+GEZZ2e5nDNcSMUrEw9Qhju7obg= sha256:HAGxCA7MDjVaHIdVKdbTfK9fkD3mS4zkj+NhLjWVIQ8= sha256:4hcBBKZ/P1PGFYYwjXSaWCxqJ59Q6aU9nS/5a0SRDI8=
In-Reply-To: <ttn9em$h0s$1@shakotay.alphanet.ch>
X-Face: 0f|`H5*Our0P$s'uj0)fS=&`R#U+JYpl<W.~uGMH[S}%Yo{$(f$0`!02mu$5b`f7Hp6:EiW
 c`zw`Y^GQAA=_IIV`NIXW4&YpH]>e<6GW!O'TO4sB4,Q9"tHNQo]\7p\,,nCZ_saH4~Ie
 'gYktutVOXK})aU*/@meZ_y=ixi8qwcJ,ssAk~G4Rr?qr60d_euHkHHJ_;EHES_(IExNo
 h6
X-No-Archive: yes
Mail-Copies-To: nobody
URL-perso: http://michelvauquois.fr
Comments: no-dodin
Bytes: 4002
Lines: 46

Dans le message <ttn9em$h0s$1@shakotay.alphanet.ch>, Benoît L. a écrit le 1er mars 2023 à 11 h 29 :

> _____________________________________________________________
> set TextToTest to "Pour parler à cœur ouvert, je mets une phrase vide,
> cœur à cœur, je mets du cœur à l'ouvrage, même si ce n'est pas de gaieté
> de cœur." as string
>
> set TextToSearch to "cœur"
> set AppleScript's text item delimiters to ","
> set TextAsList to text items of TextToTest
> repeat with i in TextAsList
>   if i does not contain TextToSearch then
>     display dialog "J’ai trouvé un « " & TextToSearch & " » qui manque
>     dans « " & i & " »."
>     exit repeat
>   end if
> end repeat
> set AppleScript's text item delimiters to ""
> _____________________________________________________________

Good mais, à mon sens, il manque quelque chose : si la phrase est 
« valide » (ie il y a le mot « cœur » dans chaque item), le script 
s'arrête et l'utilisateur va se demander si le script a planté ou 
autre chose.
Il faudrait au moins ajouter un avertissement signalant que la 
phrase est « valide » :
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
set laPhrase to "Pour parler à cœur ouvert, cœur à cœur, je mets beaucoup de coeur, même si ce n'est pas de gaieté de cœur." as text

set text item delimiters to ","
set laPhrase to every text item of laPhrase

repeat with text_item in laPhrase
  if "cœur" is not in text_item then
    display alert "La phrase est invalide :" & return & "« cœur » est absent de « " & text_item & " »." giving up after 5
    return
  end if
end repeat
display alert "La phrase est valide." giving up after 4
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

Redirection vers fcsmp
-- 
🇺🇦 Michel Vauquois - <http://michelvauquois.fr> 🇺🇦
Quand un philosophe me répond, je ne comprends plus ma question. (Pierre
Desproges)