LoginSignup
3
2

More than 1 year has passed since last update.

Dartでも愛が生まれた

Last updated at Posted at 2017-01-22

元ねた

愛が生まれた - Qiita

実装

main() => print(new String.fromCharCode("生".codeUnitAt(0) & "死".codeUnitAt(0)));

DartPad

DartPad で実行

感想

流れに完全に乗り遅れているけど、Dartが無いので、ついカッとなってやった、反省していない
char型と暗黙型変換がないとこんなもんですね。
何をやっているかを意識して書かないと動かないのはむしろ良いこと。


Dart 2.0で若干短くなった。

main() => print(String.fromCharCode("生".codeUnitAt(0) & "死".codeUnitAt(0)));

DartPad

DartPad で実行


'生'も'死'も'愛'もサロゲートペアで無いのでコードポイント(rune)操作で良いはず。

main() => print(String.fromCharCode('生'.runes.first & '死'.runes.first));
3
2
3

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
2