fork(2) download
  1. class Minimal
  2. {
  3. static String RemovePunct(String input)
  4. {
  5. char[] output = new char[input.length()];
  6. int i = 0;
  7.  
  8. for(char ch : input.toCharArray())
  9. {
  10. if (Character.isLetterOrDigit(ch) || Character.isWhitespace(ch))
  11. {
  12. output[i++] = ch;
  13. }
  14. }
  15.  
  16. return new String(output);
  17. }
  18.  
  19. public static void main (String [] Argv) {
  20. String s = RemovePunct("This is (a) test string.");
  21. System.out.println("'" + s + "'");
  22. }
  23. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
'This is a test string'