99热99这里只有精品6国产,亚洲中文字幕在线天天更新,在线观看亚洲精品国产福利片 ,久久久久综合网

歡迎加入QQ討論群258996829

Swift 函數(shù)式工具庫 Dollar

發(fā)布時間:2016-05-17 23:57  回復(fù):0  查看:5214  感興趣:16  贊:0   最后回復(fù):2016-05-17 23:57  

Dollar 是一個 Swift 庫,為 Swift 編程語言提供函數(shù)式編程的助手方法,類似 Lo-Dash 或者 JavaScript 里的 Underscore。

示例代碼:

取最大值:

$.max([1, 2, 3, 4, 2, 1]) 
//4
從數(shù)組中移除指定值

$.pull([3, 4, 5, 3, 5], values: 3, 5) 
// [4]

$.pull([3, 4, 5, 3, 5], values: 4) 
//[3, 5, 3, 5]

$.pull([3, 4, 5, 3, 5], values: 3, 4, 5) 
//[]
獲取數(shù)組中最后一個元素

$.last([3, 4, 5]) 
//5
通過下標(biāo)從數(shù)組中找出數(shù)據(jù)

$.at(["ant", "bat", "cat", "dog", "egg"], indexes: 0, 2, 4) 
// ["ant", "cat", "egg"]
還有上百個函數(shù)請參考開源代碼主頁上的說明。

相關(guān)開源代碼

您還未登錄,請先登錄

熱門帖子

最新帖子

?