//字符串反转 NSString *str = @"abcedfghijklmnopqrstuvwxyz"; NSMutableString *string = [NSMutableString stringWithCapacity:str.length]; int j = (int)str.length; for (int i = j - 1; i>=0; i--) { [string appendFormat:@"%c",[str characterAtIndex:i]]; } NSLog(@"string is-- %@",string);
输出如下:
string is-- zyxwvutsrqponmlkjihgfdecba
仅做记录!