Java .contains not actually searching my arraylist -


edit: re-writing whole question.

public static int search(arraylist addressbook)//handles search functionality     {         scanner input = new scanner(system.in);         string searchmodifier;//declaring variables         int noentry = -1;          system.out.print("\n\nplease enter value search for: ");//empowering user         searchmodifier = input.next();//gathering searchmodifier          system.out.print (addressbook);          if(addressbook.contains(searchmodifier))//if searchmodifier found             return addressbook.indexof(searchmodifier);//return index value         else             return noentry;     } 

above function i'm having issues with. call file. when insert system.out.print(addressbook) system before "if" statement, following:

arraylist output

clearly, it's in there. why isn't showing up?

what mean "searchmodifier"? has same string should present in arraylist , contains case sensitive search.
if trying search part of string arraylist.contains() not meant it.

edit can below have loop, that's catch.

for (int = 0; < arraylist.size(); i++) {             if(arraylist.get(i) != null && arraylist.get(i).tolowercase().contains("your_match_string".tolowercase())){                 //match found...             }         } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -