[Swift]map()で配列を生成するサンプル

書式
$0.uppercased()
使用例

let cft = ["Aa", "Bb", "Cc"]
let result = cft.map { $0.uppercased() }

print(cft)
print(result)

実行結果
[“Aa", “Bb", “Cc"]
[“AA", “BB", “CC"]

Swift

Posted by arkgame