如何将 Unicode 无穷大符号转换为字符串 [英] how can i get the Unicode infinity symbol converted to String
问题描述
我想在 java 中使用无穷大符号(8 个横着放).
I want to use the infinity symbol (8 lying sideways) in java.
此外,我想将其用作 String 组件.
我没有为此找到可用的 charcode/ascii 代码(有吗?).
furthermore i want to use it as a String component.
i did not find a working charcode/ascii code for this (is there any?).
我试过:
String s=Character.toString(236);
String s=Character.toString('236');
我错过了什么吗?
我现在明白了:
System.out.println(Character.toString('\u221E'));
但输出是?
我正在使用 java 1.7 jdk 和 eclipse.为什么无穷大符号没有出现?
i am using java 1.7 jdk and eclipse. why is the infinity sign not showing up?
推荐答案
你需要 Unicode 无穷大符号,U+221E.236 是 Windows 打字约定,它根本不会帮助你.'\u221e'
是字符常量.
You need the Unicode infinity sign, U+221E. 236 is a Windows typing convention, that won't help you at all. '\u221e'
is the character constant.
现在,我不能保证这会导致任何 ∞屏幕上的字符.这取决于您拥有哪种类型的计算机、您使用的字体以及您在 -Dfile.encoding 中设置的内容.另请参阅此问题.
Now, I can't promise that this will result in any ∞ characters on your screen. That depends on what sort of computer you have, what font you are using, and what you set in -Dfile.encoding. Also see this question.
这篇关于如何将 Unicode 无穷大符号转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!