I'm having a special character é.
Unicode character is 233.
I want to read this Unicode character from a string and convert it into another unicode character.
Please let me know the reading and writing of Unicode characters in java.
Printable View
I'm having a special character é.
Unicode character is 233.
I want to read this Unicode character from a string and convert it into another unicode character.
Please let me know the reading and writing of Unicode characters in java.
Not sure what this means. Strings are sequences of unicode characters. Unicode chars range in value from 0 to \uFFFF.Quote:
ead 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
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);
}
}