AppleScript名:配列から要素を削除する(要素をインデックスで指定)v2 |
— Created 2017-10-29 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" –Chapter 6 Lib.asobjcex3doc set theList to {1, 2, 3, 4, 5, 6, 7, 8, 9} set bList to my deleteItemsAtIndexes:{3, 5, 7, 1} fromList:theList –> {2, 4, 6, 8, 9} set bList2 to deleteItems of me by {3, 5, 7, 1} from theList –> {2, 4, 6, 8, 9} set bList3 to deleteItemsBy({3, 5, 7, 1}, theList) of me –> {2, 4, 6, 8, 9} –Objective-Cライクなパラメータ記述 on deleteItemsAtIndexes:theIndexes fromList:theList set theArray to current application’s NSMutableArray’s arrayWithArray:theList set theSet to current application’s NSMutableIndexSet’s indexSet() repeat with anIndex in theIndexes (theSet’s addIndex:(anIndex – 1)) end repeat theArray’s removeObjectsAtIndexes:theSet return theArray as list end deleteItemsAtIndexes:fromList: –無意味区による装飾 on deleteItems by theIndexes from theList set aList to my deleteItemsAtIndexes:theIndexes fromList:theList return aList end deleteItems –Pure AS風のパラメータ記述 on deleteItemsBy(theIndexes, theList) set aList to my deleteItemsAtIndexes:theIndexes fromList:theList return aList end deleteItemsBy |
More from my site
(Visited 30 times, 1 visits today)