<span style="font-size:24px;">NSString *str4 = [[NSString alloc] initWithFormat:@"http://www.baidu.com"];
BOOL isSuffix = [str4 hasSuffix:@"png"];
NSLog(@"isSuffix = %d", isSuffix);
if (isSuffix == 1) {
NSString *newStr1 = [str4 stringByReplacingOccurrencesOfString:@"png" withString:@"jpg"];
NSLog(@"%@",newStr1);
}else {
NSString *newStr2 = [str4 stringByAppendingFormat:@".jpg"];
NSLog(@"%@", newStr2);
}
</span>