How do I search a string array with start with keyword?
for example,
String[] str = { \"abcd\", \"abdc\", \"bcda\"};
when my search str
String[] strArray = {"abcd", "abdc", "bcda"};
for (String s : strArray)
if (s.startsWith(searchTerm))
System.out.println(s);
Swap startsWith
for contains
you wish to simply look for containment.
You should check this method:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#contains%28java.lang.CharSequence%29