using the 'split' method in java using 2 or more spaces as a delimiter


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. String str="This is my Red house";
  2. String[] result=str.split(" +");
  3.  
  4. for (int i=0;i<result.length;i++)
  5. {
  6. System.out.println("The result is ==== "+result[i]);
  7.  
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.