fork(1) download
  1. class Ideone
  2. {
  3. public static void main (String[] args) throws java.lang.Exception
  4. {
  5. String s = " He is a very very good boy, isn't he? ";
  6. String []tokens = s.trim().split("[\\s,'?]+");
  7. int n = tokens.length;
  8. System.out.println(n);
  9. for(int i=0;i<tokens.length;i++)
  10. {
  11. System.out.println("'" + tokens[i] + "'");
  12. }
  13. }
  14. }
Success #stdin #stdout 0.09s 320512KB
stdin
Standard input is empty
stdout
10
'He'
'is'
'a'
'very'
'very'
'good'
'boy'
'isn'
't'
'he'