PDA

View Full Version : caseinsensitive qstringlist



hashb
17th December 2010, 03:41
Hi ,

How can I create a caseinsensitive qstringlist?



QStringList sl(...) ; //suppose it is case insensitive


sl<<"hello";
sl<<"Hello";
sl<<"HELLO";



So if I execute sl.remove("hello");
all items above will be removed from sl

Thanks

franz
17th December 2010, 08:36
QStringList itself doesn't do that, but you could use the filter() functions. They allow you to set case sensitivity. However, you would need to use a negative regexp: everything not matching "hello" should be returned. Of course you could also filter out everything that matches hello and then run through that list to remove it from the original list...

Unfortunately both options don't really give you a case insensitive list.