Convert char to unicode
public class Main {
public static void main(String[] argv) {
System.out.println(unicodeEscaped('a'));
}
public static String unicodeEscaped(char ch) {
if (ch < 0x10) {
return "\\u000" + Integer.toHexString(ch);
} else if (ch < 0x100) {
return "\\u00" + Integer.toHexString(ch);
} else if (ch < 0x1000) {
return "\\u0" + Integer.toHexString(ch);
}
return "\\u" + Integer.toHexString(ch);
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
Data Type Char:
- Create Character from char value
- Compare Character
- Character.isLowerCase, isUpperCase check the letter case
- Character.isLetter checks if a char is a letter
- Character.isDigit checks the if a char is a digit
- Character.isWhitespace checks if a letter is a space
- Character.UnicodeBlock checks a Character's Unicode Block
- Convert char to integer ASCII code
- Convert ASCII code int value to String
- Convert char to unicode
- Convert char array to string
- Get next char value
- Store unicode in a char variable
- Check char type
- Max and Min values of char