ios 开发之--逆序输出字符串
//字符串反转 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
仅做记录!
本文来自博客园,作者:稻草人11223,转载请注明原文链接:https://www.cnblogs.com/hero11223/p/14721601.html