1D Listから指定文字列で終わっている要素を削除して返すAppleScriptです。
AppleScript名:1D Listから指定文字列で終わっている要素を削除して返す |
— Created 2018-04-24 by Takaaki Naganoya — 2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aList to {"aVar", "level1’s", "level2’s", "level3’s", "bVar", "level10’s", "level11’s", "level12’s"} set bList to my fiter1DList:(aList) byTailingKeyword:"’s" –> {"aVar", "bVar"} –指定文字列が末端にある要素を除外 on fiter1DList:(aList as list) byTailingKeyword:(keyWord as string) set itemCount1 to count every item of aList set tmpArray to current application’s NSMutableArray’s arrayWithArray:aList set thePred2 to current application’s NSPredicate’s predicateWithFormat_("!(self ENDSWITH %@)", keyWord) set bArray to (tmpArray’s filteredArrayUsingPredicate:thePred2) as list of string or string return bArray end fiter1DList:byTailingKeyword: |
More from my site
(Visited 39 times, 1 visits today)