Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,28 @@
object UTF8 extends App {
def charToInt(s: String) = {
def charToInt0(c: Char, next: Char): Option[Int] = (c, next) match {
case _ if (c.isHighSurrogate && next.isLowSurrogate) =>
Some(java.lang.Character.toCodePoint(c, next))
case _ if (c.isLowSurrogate) => None
case _ => Some(c.toInt)
}
if (s.length > 1) charToInt0(s(0), s(1)) else Some(s.toInt)
}
def intToChars(n: Int) = java.lang.Character.toChars(n).mkString
println('\uD869'.isHighSurrogate + " " + '\uDEA5'.isLowSurrogate)
println(charToInt("\uD869\uDEA5"))
val b = "\uD869\uDEA5"
println(b)
val c = "\uD834\uDD1E"
println(c)
val a = "$abcde¢£¤¥©ÇßçIJijŁłʒλπ•₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵₵←→⇒∙⌘☺☻ア字文𪚥".
map(c => "%s\t\\u%04X".format(c, c.toInt)).foreach(println)
}