• RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
Posted by Jack - - 2 comments


Searching the elements of a String array, starts with SEARCHTEXT (String)

public static ArrayList<String> searchFromStart(String[] inputArray, String searchText) {

            ArrayList<String> outputArray = new ArrayList<String>();

            for (int i = 0; i < inputArray.length; i++) {

                        if (searchText.compareToIgnoreCase(inputArray[i].substring(0,
                                                searchText.length())) == 0) {

                                    outputArray.add(inputArray[i]);

                        }

            }

            return outputArray;
}

2 Responses so far.

  1. bdmapper says:

    There is a method called startsWith in java ..

  2. Shekhar says:

    How i create a poker game in eclipse.......please give me a brefing on this topic

Leave a Reply