AppleScript名:2Dリスト内の要素のうち最多のアイテム数を求める |
— Created 2017-10-01 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aList to {{1, 2, 3, 4, 5, 6, 4}, {1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6, 0, 0}} –7,6, 8 items set aRes to getMaxItemCountFrom2DArray(aList) of me –> 8 –max items is 8 on getMaxItemCountFrom2DArray(aList) set anArray to current application’s NSArray’s arrayWithArray:aList set eRes to (anArray’s valueForKeyPath:"@unionOfObjects.@count")’s valueForKeyPath:"@max.self" return eRes as integer end getMaxItemCountFrom2DArray |
More from my site
(Visited 21 times, 1 visits today)