LoginSignup
3
0

More than 5 years have passed since last update.

Swift で「千反田える」❷

Last updated at Posted at 2017-02-13

千反田えるね

(1...1000).forEach { (x) in
    let s = String(x).unicodeScalars.reversed().enumerated().map({ (i, y) -> String in
        y.value == 48 ? "" : "\(y.value == 49 && i != 0 && i < 4 ? "" : ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"][Int(y.value - 48)])\(["", "十", "百", "千", "万"][i])"
    }).reversed().joined()
    print("\(s)反田\(["えー", "びー", "しー", "でぃー", "いー", "えふ", "じー", "えいち", "あい", "じぇい", "けい", "える", "えむ", "えぬ", "おー", "ぴー", "きゅー", "あーる", "えす", "てぃー", "ゆー", "ゔぃー", "だぶりゅー", "えっくす", "わい", "ぜっど"][(x-1)%26])")
}

Screen Shot 2017-02-13 at 7.47.37 PM.png

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0