fork(24) 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. // your code goes here
  13. String str = "I am a, JAVA programmer";
  14. String[] splited = str.split("\\b+"); //split on space
  15. System.out.println("Search ram :"+ Arrays.asList(splited).contains("ram"));
  16. System.out.println("Search I :"+ Arrays.asList(splited).contains("I"));
  17. System.out.println("Search JAVA :"+ Arrays.asList(splited).contains("JAVA"));
  18. System.out.println("Search g :"+ Arrays.asList(splited).contains("g"));
  19. System.out.println("Search programmer :"+ Arrays.asList(splited).contains("programmer"));
  20. }
  21. }
Success #stdin #stdout 0.08s 380160KB
stdin
Standard input is empty
stdout
Search ram :false
Search I :true
Search JAVA :true
Search g :false
Search programmer :true