mercredi 1 avril 2015

Find items in list where word exist and ignor special chars

I have list of MyItems



My item
{
string name;
int age;
}

List<MyItem> list = new List<MyItem>();
list.Add(new Test("name", 2));
list.Add(new Test("ŚćĄa", 4));
list.Add(new Test("May NĄmĄa bb" , 7));
list.Add(new Test("May maa cc" , 7));


for now with var NewList = list.Where(m => m.name.ToLower().Contains(textToSearch.ToLower())).ToList();


I can ignore lower and upper case, but how to ignore special chars like ĄĆŚ when I set textToSearch = "aa"; I will get item two, three and four, but when I set textToSearch = "ĄA"; I want to get only item two and four


Aucun commentaire:

Enregistrer un commentaire