Thread: searching
View Single Post
  #4 (permalink)  
Old 12-06-2007, 04:56 AM
staykovmarin staykovmarin is offline
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
Here is a simpler way, although less powerful, it might be better suited for whatever you are doing.
Code:
String [] array = {"bfg", "fgj", "cde", "efg", "ght"}; String toTest = "abcdefg"; for(int i = 0; i < array.length; i++) { if (toTest.contains(array[i])) System.out.println(array[i] + " is contained"); }
Reply With Quote