开发者

How to import basic symbols in java IDEs

I am using jGRASP and I want to use this symbol: ≥ in my string statement.

System.out.println("symbol for greater or equal then is ≥");

but the problem is I cant copy paste the symbol to the IDE. 开发者_C百科it gives me weird content:

PrFont34Bin0BinSub0Frac0Def1Margin0Margin0Jc1Indent1440Lim0Lim1?

I can use => but that looks vague for human viewing.


You can \u escape them.

System.out.println("symbol for greater or equal then is \u2265");

Btw, one quick and easy way to get the hex of a symbol if you're copying and pasting is to open http://squarefree.com/shell/shell.html and do something like

'≥'.charCodeAt(0).toString(16)

which should print out the hex. Then pad that to 4 digits and stick \u in front. This works for all non-supplemental unicode characters in java except for quotes and newlines.


Even in a dialog, you may have a default font with no representation for that character. It might show up on your system, but not on another.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜