2016-03-16 字符串的包含
1:
这个在ios8以后才可以的
NSString *string = @"hello bla blah";
NSString *string = @"hello bla blah";
if ([string containsString:@"bla"])
{
NSLog(@"string contains bla!");
} else {
NSLog(@"string does not contain bla");
}
2:
//字条串是否包含有某字符串 gzz0307 这个不会崩溃ios7
if ([getString rangeOfString:@"="].location == NSNotFound) {
MCLog(@"==不做处理==");
} else {
MCLog(@"包含 ====");
NSArray *arry=[getString componentsSeparatedByString:@"="];
NSString *lastString=[arry objectAtIndex:1];
StrartQv=[NSString stringWithFormat:@"%@",lastString];
}