Guest User

Untitled

a guest
Nov 13th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. let c = Character(Unicode.Scalar("98765")!)
  2.  
  3. let c = Character(Unicode.Scalar(12345)!)
  4. (`Unicode.Scalar("12345")!` causes runtime crash.)
  5.  
  6. extension Character {
  7. init?(_ codePoint: UInt32) {
  8. guard let us = Unicode.Scalar(codePoint) else {
  9. return nil
  10. }
  11. self = Character(us)
  12. }
  13. }
  14.  
  15. print(Character(12345)!)
Add Comment
Please, Sign In to add comment