Sub Process_Globals
Private bc As ByteConverter
End Sub
Sub Globals
Private EditText1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
EditText1.Text = UTS(0x1F600) & UTS(0x1F601) & UTS(0x1F602)
Dim cp() As Int = ToCodePoints(EditText1.Text)
Log($"Text length: ${cp.Length}"$)
For Each codepoint As Int In cp
Log(codepoint)
Next
End Sub
Sub ToCodePoints(str As String) As Int()
Dim b() As Byte = str.GetBytes("UTF-32BE")
Return bc.IntsFromBytes(b)
End Sub
Sub UTS (codepoint As Int) As String
Dim b() As Byte = bc.IntsToBytes(Array As Int(codepoint))
Return BytesToString(b, 0, 4, "UTF-32BE")
End Sub