NSString *str = [NSString stringWithFormat:@"tupian.png"];
BOOL isSuffix = [str hasSuffix:@"png"];
if (isSuffix == 1) {
NSLog(@"该字符串名是以png结尾.");
NSString *str1 = [str stringByReplacingOccurrencesOfString:@"png" withString:@"jpg"];
NSLog(@"替换后的字符串为:%@",str1);
}else{
NSLog(@"该字符串不是以png结尾");
NSString *str2 = [str stringByAppendingString:@".jpg"];
NSLog(@"拼接后字符串为:%@",str2);
}