开发者

ChrW and AscW equivalent in Java (with Android SDK)

开发者 https://www.devze.com 2023-03-07 20:19 出处:网络
I need the function that return the Ascii code (actually Unicode number code), 开发者_Python百科as well as convert that code to the Unicode character one. They are ChrW and AscW in .NET. Ex: AscW(\"A\

I need the function that return the Ascii code (actually Unicode number code), 开发者_Python百科as well as convert that code to the Unicode character one. They are ChrW and AscW in .NET. Ex: AscW("A") is 65, ChrW(65) is A.

Thanks.


Actually, those are from VB.NET, not actually the .NET Framework.

In Java a char is sort of a integral type. You can convert it to int and back:

String s = "abc";
char a = s.charAt(0);
int a_codepoint = (int)a;

char x = (char)120;
0

精彩评论

暂无评论...
验证码 换一张
取 消