两个指定的字符不一样
NSString *aa=@"#ABC#abc";
NSRange star=[aa rangeOfString:@"("];
NSRange end=[aa rangeOfString:@")"];
NSString *sub=[aa substringWithRange:NSMakeRange(star.location, end.location-star.location+1)];
NSLog(@"sub %@",sub);
两个指定的字符一样
NSString *aa=@"#AB1234567C#a4567bc";
NSRange star=[aa rangeOfString:@"#"];
NSRange end=[[aa substringFromIndex:1] rangeOfString:@"#"];
NSString *sub=[aa substringWithRange:NSMakeRange(star.location, end.location-star.location+2)];
NSLog(@"sub %@",sub);