Apple Devices meet 令和
2019年5月14日にiOS 12.


macOS [System Preferences]→


なお、
#!/usr/bin/env swift
import Foundation;
let df = DateFormatter();
df.locale = Locale(identifier:"ja_JP")
df.calendar = Calendar(identifier:.japanese)
df.dateFormat = "Gy年MM月dd日HH時mm分ss秒ZZZZZ"
print(df.string(from:Date()))
令和元年05月23日16時37分10秒+09:00
と表示されましたが、
平成31年05月23日16時37分10秒+09:00
と表示されました。なお、
Unicode 12.1はまだ
元号の処理は基本的にはOSの処理ですが、
"\u{337E}".decomposedStringWithCompatibilityMapping // "明治"
"\u{337D}".decomposedStringWithCompatibilityMapping // "大正"
"\u{337C}".decomposedStringWithCompatibilityMapping // "昭和"
"\u{337B}".decomposedStringWithCompatibilityMapping // "平成"
"\u{32FF}".decomposedStringWithCompatibilityMapping // "令和"じゃない!
のような正規化がそれに該当するのですが、


メソッド名にもCompatibilityMapping
とあるとおり、
もっとも、
次回予告
次回はWWDC特集を予定しております。
本誌最新号をチェック!
Software Design 2022年9月号
2022年8月18日発売
B5判/192ページ
定価1,342円
(本体1,220円+税10%)
- 第1特集
MySQL アプリ開発者の必修5科目
不意なトラブルに困らないためのRDB基礎知識 - 第2特集
「知りたい」「使いたい」「発信したい」をかなえる
OSSソースコードリーディングのススメ - 特別企画
企業のシステムを支えるOSとエコシステムの全貌
[特別企画]Red Hat Enterprise Linux 9最新ガイド - 短期連載
今さら聞けないSSH
[前編]リモートログインとコマンドの実行 - 短期連載
MySQLで学ぶ文字コード
[最終回]文字コードのハマりどころTips集 - 短期連載
新生「Ansible」徹底解説
[4]Playbookの実行環境(基礎編)