java - contains method of String is not working properly -


i have 1 question not able solve .

  public static  void main(string [] arg) {              string description = "this time $fb highest priority";          list<string> list = new arraylist<string>();          list.add("$fb");          list.add("$f");          for(string s : list) {            if(description.contains(s)) {               system.out.println(s);            }           } } 

the out put getting $fb , $f dummy string contains 1 string of list .. other method give exact match ?

it looks want see if word contained. can this:

set<string> words = new hashset<string>(arrays.aslist(description.split(" ")));  ... words.contains(s) ... 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -