Re: difficulty with list filtering
Re: difficulty with list filtering
- Subject: Re: difficulty with list filtering
- From: Malcolm Fitzgerald <email@hidden>
- Date: Mon, 14 May 2007 09:42:22 +1000
On 13/05/2007, at 7:38 PM, Patrik B. wrote:
Trying to filter through a list and am almost there, just need a
little help.
The problem I have is:
1) I can only check if A is contained in B. A is defined as "GER" but
B is
defined as {"ENG", "SPA", "GER", "FRE") etc. so my script currently
finds
alterations of it i.e. "enG", "GEr", "FRI" however how do I make it so
it also
detects "GGER", "blablah-GER-jkj" i.e. any variation of preceeding
text or
following text is not ignored as it is really "contained" in it.
You have two jobs. First, you want to see if the the current item is
contained in the list. That's quick and easy.
ignoring case
{"ENG", "SPA", "GER", "FRE"} contains "GER"
end ignoring
Secondly you want to see if any substring of the items of the list
contains the current item. That's more work.
repeat with currentItem in {"ENG", "SPA", "GER", "FRE"}
ignoring case
offset of "GER" in currentItem
end ignoring
end repeat
One thing to notice is that the second job happens to perform the
first job. So you can drop the first job, just do the second job.
malcolm
_______________________________________________
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