fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.util.stream.Collectors ;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. String input = "an\0Example" ;
  15. System.out.println(
  16. Arrays.toString(
  17. input.codePoints().toArray()
  18. )
  19. );
  20.  
  21. StringBuilder sb = new StringBuilder() ;
  22. for( int codePoint : input.codePoints().toArray() ){
  23. if( ! Character.isISOControl( codePoint ) ) {
  24. sb.appendCodePoint( codePoint ) ;
  25. }
  26. }
  27. String output = sb.toString() ;
  28.  
  29. System.out.println( output ) ;
  30. System.out.println( Arrays.toString( output.codePoints().toArray() ) ) ;
  31. System.out.println( output.codePoints().mapToObj( Character :: toString ).collect( Collectors.toList() ) ) ;
  32. }
  33. }
Success #stdin #stdout 0.09s 52772KB
stdin
Standard input is empty
stdout
[97, 110, 0, 69, 120, 97, 109, 112, 108, 101]
anExample
[97, 110, 69, 120, 97, 109, 112, 108, 101]
[a, n, E, x, a, m, p, l, e]