Last active
May 21, 2017 18:36
-
-
Save creaaa/066a94d0ebfecf419210ccc181701a1f to your computer and use it in GitHub Desktop.
A-Zの配列 (Swift)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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