字符串倒序输出

    NSString *string = @"qwer";
    NSMutableString *newString = [[NSMutableString alloc] initWithCapacity:string.length];
    for (int i = (int)string.length - 1; i >=0 ; i --) {
        unichar ch = [string characterAtIndex:i];
        [newString appendFormat:@"%c", ch];
    }
    NSLog(@"%@", newString);

你可能感兴趣的:(字符串倒序输出)