51 routines :

*AppleScriptsVanilla*
ascii_to_HTML
Average
Calculator
Calendar
Count_item
cut_text
days_week
EAN13
Encrypt-Decrypt
FactPremier
French_Vanilla_Dotted_Date
French_Vanilla_Dotted_Date2
Hexa_to_Bin
Last_month
list_erase
list_insert
list_replace
ListeDiviseurs
ListePremiers
Minuscule
NombreLong
NombreLong2
NomExtension
num_item
num_month
num_month2
num_week
number_format
number_format2
Paques
PGCD
PGCD2
reverse_string
Roman_to_Arab
round_decimal
search_email
search_replace
search_URL
SepNbre
SepNbre2
snip_text
stat
TauxPermut
TauxTransform
the_left
the_right
TriBulle
TriLineaire
week_and_year
XOR
ZeroDouble

search_URL

Syntaxe

SearchURL(theString)
Extrait les URLs d'une chaîne de caractères (theString) sous forme de liste. Le paramètre est au format texte, le résultat au format liste.

Exemple

SearchURL("xxxxxxx http://www.site1.com yyyy http://www.site2.com zzzzzz")
---> {"http://www.monsite1.com", "http://www.monsite2.com"}

Script

on SearchURL(theString)
set listURL to ""
set the theString to " " & theString & " "
repeat until the length of theString is 0
set A to offset of "http://" in theString
if A = 0 then exit repeat
set theEnd to the length of theString
set temp to characters A thru theEnd of theString as string
set B to offset of " " in temp
set theURL to (characters A thru (A + B - 2)) of theString as string
set listURL to (listURL & theURL as list)
set theString to characters (A + B - 1) thru theEnd of theString as string
end repeat
return listURL
end SearchURL

Remarque

La méthode consiste à chercher ce qui caracterise une URL çàd "http://" puis a compter les caractères jusqu'au prochain " " qui signifie que l'URL est complet, sur la forme. L'ajout d'une espace " " en début et en fin de chaîne (set the theString to " " & theString & " "), évite que la commande offset ne renvoie un message d'erreur à la fin de l'éxécution de la routine.

Site scripté avec HyperCard ©1987-1998 Apple Computer, Inc.
Mise à jour le 19/01/10 à 08:45:57