AppleScript名:2D Listから条件抽出(パラメータ外部指定) |
— Created 2017-11-03 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" property NSPredicate : a reference to current application’s NSPredicate property NSArray : a reference to current application’s NSArray set aList to {{"Apple", 2}, {"Lemon", 3}, {"Apple", 4}, {"Water Melon", 2}} set aTarg to {"Apple", 2} set anArray to NSArray’s arrayWithArray:aList set aPred to NSPredicate’s predicateWithFormat_("SELF[0] = %@ && SELF[1] >= %@", item 1 of aTarg, item 2 of aTarg) set bRes to (anArray’s filteredArrayUsingPredicate:aPred) as list –> {{"Apple", 2}, {"Apple", 4}} |
More from my site
(Visited 22 times, 1 visits today)