It seems that NSCaseInsensitiveSearch
not works in NSString:rangeOfCharacterFromSet
. Can someone explain why? is it correct behaviour?
NSString *string = @"James Bond Always Rocks";
NSRange range = [string rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"J"] options:NSCaseInsensitiveSearch];
NSLog(@"range->%@",NSStringFromRange(range)); //This prints range->{0, 1}
NSString *string = @"James Bond Always Rocks";
NSRange range = [string rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"j"] options:NSCaseInsensitiveSearch];
NSLog(@"range->%@",NSStringFromRange(range)); //This prints range->{2147483647, 0}