I have found that using the ‘where’ reserved word to filter or search is much faster than manually stepping through a list to search for a match, such as:
tell application "Address Book"
set theContacts to (get every person where ¬
the first name is "Jon")
end tell
But recently I’ve been trying to use it find bad chars from a string like this:
property chars : {"a", "e", "i", "o", "u"}
property chars2 : "aeiou"
set newname to "Hello"
set badChars to (get every character in newname where it is in chars)
return badChars
but if I search using chars or chars2, it gives me back the error
whereas I think it should return the list {“e”, “o”}
Do I need to do some sort of coercion? I tried using “(it as character) is in chars” but that didn’t work either. Any ideas?
Thanks