简体   繁体   English

在NetBeans或Eclipse中使用Shorcut作为货币符号

[英]Shorcut in NetBeans or Eclipse for currency symbol

In Java, I can display currency in decimal format with currency symbol ¤ 在Java中,我可以用十进制格式显示货币符号¤

http://download.oracle.com/javase/tutorial/i18n/format/decimalFormat.html http://download.oracle.com/javase/tutorial/i18n/format/decimalFormat.html

In NetBeans and Eclipse, how to type this ¤ symbol. 在NetBeans和Eclipse中,如何键入此¤符号。 Actually in this question I do copy and paste. 实际上在这个问题上我会复制并粘贴。

To type a character like ¤ you would hold the Alt key down and type 0164 (tested on Windows). 要键入像¤这样的字符,您可以按住Alt键并键入0164 (在Windows上测试)。

In Windows you can see the Character Map by clicking the Start button and navigating to the Accessories folder where you will find a System Tools folder which contains the Character Map application. 在Windows中,您可以通过单击“ Start按钮并导航到“ Accessories文件夹来查看“字符映射”,在该文件夹中可以找到包含“字符映射”应用程序的“ System Tools文件夹。

On a Gnome system it is located in the Applications > Accessories > Character Map menu item 在Gnome系统上,它位于Applications > Accessories > Character Map菜单项中

NetBeans Shortcut NetBeans快捷方式

One way to do this in NetBeans is to create a Code Template that will handle the expansion for you. 在NetBeans中执行此操作的一种方法是创建一个Code Template ,以便为您处理扩展。 To do this, click Tools > Options > Editor > Code Templates and create a new template with the ¤ character as the Expanded Text . 为此,请单击Tools > Options > Editor > Code Templates然后使用¤字符作为Expanded Text创建新模板。 Then you can use whatever Abbreviation that you defined for the Code Template and press the TAB button to expand it. 然后,您可以使用为Code Template定义的任何Abbreviation ,然后按TAB按钮将其展开。

For example, I defined a new Code Template that used the Abbreviation of gc for the generic currency symbol. 例如,我定义了一个新的Code Template ,它使用gcAbbreviation作为通用货币符号。 Now when I type gc and press TAB in the editor, it gets expanded to ¤ . 现在,当我在编辑器中键入gc并按TAB时,它会扩展为¤

Eclipse Shortcut Eclipse快捷方式

To create a Code Template in Eclipse, go to the Preferences panel through Window > Preferences and expand the Java > Editor > Templates section. 要在Eclipse中创建Code Template ,请通过“ Window > Preferences转到“首选项”面板,然后展开Java > Editor > Templates部分。 Once there, click the New.. button and fill out the Name , select a Context that the template will be available in and in the Pattern text area type the ¤ symbol. 在那里,单击New..按钮并填写Name ,选择模板将可用的Context并在Pattern文本区域中键入¤符号。

To expand the template in whichever Context you chose, type (for example) gc and then use the Control + Space combination to expand the template. 要在您选择的任何Context展开模板,请键入(例如) gc ,然后使用Control + Space组合展开模板。 If other similar values map to the letters you've chosen then the code completion list will appear and you will need to select your template from the list. 如果其他类似的值映射到您选择的字母,则会出现代码完成列表,您需要从列表中选择您的模板。

On personal computers running the Microsoft Windows or DOS operating systems, additional characters to those available in the current keyboard layout can be typed using an Alt code : pressing and holding the Alt key while entering a character code with the keyboard's numeric keypad. 在运行Microsoft Windows或DOS操作系统的个人计算机上,可以使用Alt code键入当前键盘布局中可用字符的附加字符:按住Alt键,同时使用键盘的数字键盘输入字符代码。

Often this is the best or only method many computer users know for entering non-ASCII characters. 这通常是许多计算机用户输入非ASCII字符的最佳或唯一方法。

You might want to see this : ALT CODES REFERENCE SHEET (This contains your ¤ and many more) 你可能想看到这个: ALT CODES REFERENCE SHEET (这包含你的¤等等)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM