public int InstancesOfWordInSentence() { string[] words = Sentence.Split(new char[] { '.', '?', '!', ' ', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries); var wordMatches = from word in words where word.ToLower() == SearchWord.ToLower() select word; return(wordMatches.Count()); }
private void UpdateListeEvent() { if (SearchWord == "" || SearchWord == null) { ListeEventToShow = ListToObservableCollectionFactory.Convert(ListeEvent); return; } ObservableCollection <Evenement> tmp = new ObservableCollection <Evenement>(); Regex r = new Regex("^.*" + SearchWord.ToLower() + ".*$"); for (int i = 0; i < ListeEvent.Count(); i++) { if (r.IsMatch(ListeEvent[i].Nom.ToLower())) { tmp.Add(ListeEvent[i]); } } ListeEventToShow = tmp; NotifyPropertyChanged("ListeEventToShow"); }
private void Display(DirectoryInfo path) { try { foreach (DirectoryInfo dir in path.GetDirectories()) { if (dir.Name.ToLower().Contains(SearchWord.ToLower())) { matches.Add(dir); } Display(dir); } foreach (FileInfo file in path.GetFiles()) { if (file.Name.ToLower().Contains(SearchWord.ToLower())) { matches.Add(file); } } } catch (Exception e1) { } }
private void Search() { Establishments = _allEstablishments.Where(a => a.Name.ToLower().Contains(SearchWord.ToLower())).ToList(); }
private void Search() { //TODO - Lógica de filtrar a lista de lojas Establishments = _allEstablishment.Where(a => a.Name.ToLower().Contains(SearchWord.ToLower())).ToList(); }