Results 1 to 3 of 3
- 09-16-2008, 12:09 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 1
- Rep Power
- 0
- 09-16-2008, 02:58 PM #2ead this Unicode character from a string and convert it into another unicode character.
What is the conversion you talk of? Lets use a different Unicode char to talk about, say 'a'. To convert it to the next letter 'b' you can add 1 to it. 'b' = 'a' + 1
- 09-16-2008, 11:02 PM #3Java Code:
import javax.swing.*; public class Test { public static void main(String[] args) { JTextArea textArea = new JTextArea(); textArea.setFont(textArea.getFont().deriveFont(18f)); char c = 'é'; int codePoint = (int)c; String hex = Integer.toHexString(codePoint); textArea.append("c = " + c + " codePoint = " + codePoint + " hex = " + hex + "\n"); char nextChar = (char)(codePoint + 1); textArea.append("nextChar = " + nextChar + "\n"); textArea.append("'a' + 1 = " + (char)('a'+1) + "\n"); textArea.append("codePoint for nextChar = " + (int)nextChar + "\n"); textArea.append("char for 0x00e9 = " + (char)0x00e9 + "\n"); textArea.append("char for \\u00e9 = " + "\u00e9"); JOptionPane.showMessageDialog(null, new JScrollPane(textArea), "", -1); } }
Similar Threads
-
Help unicode character
By JT4NK3D in forum New To JavaReplies: 3Last Post: 11-18-2007, 08:55 AM
Bookmarks