希望使用特殊字符,例如:(£, ¥)
,這些鍵盤中沒有準備某些字符串。在Java中需要使用特殊字符(未在鍵盤中給出)
回答
如果您知道字符的Unicode字符代碼,您可以使用\ uXXXX方法將字符放入代碼中的字符串中。
我建議不要那樣做,因爲它很難閱讀。 – Philipp
@ Philipp如果確實使用了這種字符,它仍然比使用編輯器字體中通常不支持的字符更好。 –
在windows上,有一個很好的實用工具叫做charmap.exe,它列出了每種字體中所有可用的字符。您可以從那裏輕鬆複製&粘貼字符。
當你需要更隱蔽的Unicode字符,你可以嘗試找到他們在這些網站之一,並複製&粘貼它們:
http://www.isthisthingon.org/unicode/index.php
這裏是ALT +數字鍵盤鍵的表,你可以輸入在Windows
http://www.irongeek.com/alt-numpad-ascii-key-combos-and-chart.html
得到符號在你的情況下,ALT + 156£和ALT + 157或190¥取決於你的鍵盤上設置
這就是數字鍵盤和窗口。在Mac上,它是£= alt + 3,alt + y =¥ – 11684
你真的應該使用UNICODE在Java代碼中像這樣的例子:從採取
//Use a string literal to assign a value to the String
String address = "I live at 22b Baker Street!";
//The same string but using Unicode values
String unicodeAddress = "\u0049\u0020\u006C\u0069\u0076\u0065"
+ "\u0020\u0061\u0074\u0020\u0032\u0032\u0042\u0020"
+ "\u0042\u0061\u006B\u0065\u0072\u0020\u0053\u0074"
+ "\u0072\u0065\u0065\u0074\u0021";
System.out.println("Here is Sherlock's address: " + address);
System.out.println("It even works using Unicode characters: " + unicodeAddress);
例。我發現this resource查找unicodes很有用。
它避免了與特殊字符編碼相關的各種問題。
- 1. 在NetBeans/Java中鍵入特殊字符(使用Alt Gr)
- 2. 在特殊盤中標記字符
- 3. 在Java中使用特殊字符(使用原始字符)
- 4. 需要特殊字符轉義在Java Web應用程序
- 5. 在非美式鍵盤上的Eclipse中的特殊字符
- 6. keybd_event,特殊字符和鍵盤佈局?
- 7. Android鍵盤重複特殊字符
- 8. 編碼特殊字符在Java中
- 9. 在java中脫逃特殊字符
- 10. 在cookies中添加特殊字符,java
- 11. Java中的特殊字符
- 12. Java中的特殊字符
- 13. 在Python中使用特殊字符
- 14. 在php中使用特殊字符echo
- 15. 在XSL中使用特殊字符
- 16. 在jQuery中使用特殊字符
- 17. 在Google Charts中使用特殊字符
- 18. 在java中,使用stringName.contains()不能使用特殊字符代碼
- 19. 需要從字符串中刪除這個特殊字符php
- 20. 試圖輸出特殊字符 - Android鍵盤發展
- 21. 用鍵盤快捷鍵替換特殊字符實時輸入
- 22. 需要替換特殊字符
- 23. 特殊字符需要打開文件
- 24. 在java中刪除字符串中的特殊字符?
- 25. 如何在java中爲所有特殊字符(',%,\,:,{,})轉義所有特殊字符
- 26. 如何在Java中使用html特殊字符?
- 27. 在Java中使用正則表達式逃脫特殊字符^
- 28. 在Java中使用特殊字符SAX解析
- 29. 在css中使用僞特殊字符之前插入特殊字符
- 30. KeyboardEvent和需要Shift鍵的特殊字符的問題
嘗試alt + [任意鍵],看看結果是什麼。你看,鍵盤上有更多的字符,你可以看到 – 11684
例如:alt + 1:¡,alt + 2,€,+3:£,+4:¢,+ y:¥ – 11684
當我必須,我谷歌他們的名字和複製+粘貼到代碼。 –