Want to find the unicode category for a given character in Java? You can determine the unicode category for a particular character by using the getType() method.
1 2 3 4 5 6 7 8 9 10 11 | public class CharacterTypeTest { public static void main(String args[]) { System.out.println("T represnts unicode category of: " + Character.getType('T')); System.out.println("@ represnts unicode category of: " + Character.getType('@')); System.out.println(") represnts unicode category of: " + Character.getType(')')); System.out.println("1 represnts unicode category of: " + Character.getType('1')); System.out.println("- represnts unicode category of: " + Character.getType('-')); System.out.println("_ represnts unicode category of: " + Character.getType('_')); System.out.println("a represnts unicode category of: " + Character.getType('a')); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.