字符串倒叙
NSString *abcd = @”abcd”;
NSMutableString *dcba = [[NSMutableString alloc]initWithCapacity:abcd.length];
for (int i = abcd.length-1 ; i >= 0 ; i–) {
[dcba appendFormat:@”%c”, [abcd characterAtIndex:i]];//注意这里返回的是char
}
NSLog(@”dcba is %@”, dcba);