tags:

views:

28

answers:

1

I use below code for check that searchText exist in name or not but this code is case sensitive means if searchText:"Home" and name :"home and " the result is that searchText doesn't exist in name

how can i remove case sensitive?

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
NSRange r = [name rangeOfString:searchText]; 
if(r.location != NSNotFound)
     //searchText exist in name
+1  A: 

use rangeOfString:options: instead, and for the options parameter use NSCaseInsensitiveSearch

See the NSString Class Reference about the above method for more info.

Jesse Naugher