fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String input = "A1😷"; // FACE WITH MEDICAL MASK is hex 1F637, decimal 128,567.
  13.  
  14. System.out.println( "input.length(): " + input.length() ) ;
  15. System.out.println( "Count code points: " + input.codePoints().count() + "\n" ) ;
  16.  
  17. input.codePoints ( ).forEach (
  18. codePoint ->
  19. {
  20. System.out.println (
  21. "Code point: " + codePoint +
  22. " | name: " + Character.getName ( codePoint ) +
  23. " | digit: " + Character.isDigit ( codePoint ) +
  24. " | = " + Character.toString ( codePoint ) +
  25. "\n- - - - - - - - - - - - - - - - - - - - "
  26. );
  27. }
  28. );
  29. }
  30. }
Success #stdin #stdout 0.26s 43256KB
stdin
Standard input is empty
stdout
input.length(): 4
Count code points: 3

Code point: 65 | name: LATIN CAPITAL LETTER A | digit: false | = A
- - - - - - - - - - - - - - - - - - - - 
Code point: 49 | name: DIGIT ONE | digit: true | = 1
- - - - - - - - - - - - - - - - - - - - 
Code point: 128567 | name: FACE WITH MEDICAL MASK | digit: false | = 😷
- - - - - - - - - - - - - - - - - - - -