📅  最后修改于: 2022-03-11 15:01:03.679000             🧑  作者: Mango
swift 5
// taken from developer.apple.com map(_:)
let cast = ["Vivien", "Marlon", "Kim", "Karl"]
let lowercaseNames = cast.map { $0.lowercased() }
// 'lowercaseNames' == ["vivien", "marlon", "kim", "karl"]
let letterCounts = cast.map { $0.count }
// 'letterCounts' == [6, 6, 3, 4]