Skip to content

Instantly share code, notes, and snippets.

@creaaa
Last active May 21, 2017 18:36
Show Gist options
  • Save creaaa/066a94d0ebfecf419210ccc181701a1f to your computer and use it in GitHub Desktop.
Save creaaa/066a94d0ebfecf419210ccc181701a1f to your computer and use it in GitHub Desktop.
A-Zの配列 (Swift)
var letters = [String]()
// 大文字: 65-90
// 小文字: 97-122
// ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
for i in 65...90 {
let char = String(Character(UnicodeScalar(i)!))
letters.append(char)
}
// もっと圧縮して書くとこうです
let strAry = (65...90).map{ String(Character(UnicodeScalar($0)!)) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment