swift - How can I get unicode number of a character? -


this question has answer here:

how can unicode number of given string ?

for example, cyrillic small letter er u+0440 stands "р"

how can "u+0440" or "0440"?

====technical information====

unicode number: u+0440

html-code: &#1088

var mystring = "р" scalar in mystring.unicodescalars {     print("\(scalar.value) ") // print: 1008 } 

440 in hex equal 1088 in decimal:

var mystring = "р" scalar in mystring.unicodescalars {     print(string(scalar.value, radix: 16)) } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -