How to search a subString from a NSString with case-insensitive
I knew a instance method of NSString.
- (NSRange)rangeOfString:(NSString *)aString
My source string looks like this: "abcdEFGhi"
When I use [srcStr.rangeOfString:@"efg"];
, there开发者_StackOverflow is no substring was found.
How can I solve this problem?
There is one more version of rangeOfString
method you could use that.
- (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask
So use as below
[srcStr rangeOfString:@"efg" options:NSCaseInsensitiveSearch];
I think you're looking for:
[srcStr rangeOfString:@"efg" options:NSCaseInsensitiveSearch];
精彩评论