indexing - swift : I try to make searching window.. what is searching method? -


example index bar below image:

i want search word in array<string> code searching method word?

example:

 var = ["coffee","juice","water"] 

searchword "co"

searching method's result "cofee",

first need iterate on array , select elements match condition, there's filter method that. in case need check if word contains string, use containsstring.

a.filter { $0.containsstring("un") } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -