e.g.
B is uppercase B.
so if I have string like "BOY". I want it converted to BOY
I'm hoping there's already a library I can use. I've searched the net but I didn't see it.
thanks
e.g.
B is uppercase B.
so if I have string like "BOY". I want it converted to BOY
I'm hoping there's already a library I can use. I've searched the net but I didn't see it.
thanks
这些代码只不过是每个字符&#
的;
Unicode 代码点的串联。您可以遍历字符串中的每个字符,然后执行以下操作:
output.append("&#")
.append((int)ch)
.append(";");
其中,output
指的是一个StringBuilder
实例。
您可以尝试编写自己的实用程序:
String input = "BOY";
char[] chars = input.toCharArray();
StringBuilder output = new StringBuilder();
for (char c : chars)
{
output.append("&#").append((int) c).append(";");
}
执行后输出内容:
BOY