Android Question UNICODE

udg

Expert
Licensed User
Longtime User
Hi Paolo,

try the following:
B4X:
Sub UnicodeEscape (s AsString) As String
Dim sb AsStringBuilder
sb.Initialize
For i = 0 To s.Length - 1
  Dim u As String = Bit.ToHexString(Asc(s.CharAt(i)))
  sb.Append("\u")
  For i2 = 1 To 4 - u.Length
    sb.Append("0")
  Next
  sb.Append(u)
Next
Return sb.ToString
End Sub

and don't forget to have a look at those nice entries for the mini-game competition!

udg
 
Last edited:
Upvote 0
Top