整数转换成字符串倒叙放在数组中遍历
//
// main.m
// Text3.1
//
// Created by 123 on 16/1/9.
// Copyright (c) 2016年 com.swl. All rights reserved.
//
#import <Foundation/Foundation.h>
#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSMutableString *mustr=[[NSMutableString alloc]init];
int i=123456789;
NSString *stringInt = [NSString stringWithFormat:@"%d",i];
mustr=[NSMutableString stringWithString:stringInt];
NSMutableArray *arr=[[NSMutableArray alloc]init];
NSRange rang;
for (int j=mustr.length-1; j+1 != nil; j--) {
rang.location=j;
rang.length=1;
NSString *newStr3=[mustr substringWithRange:rang];
//NSLog(@"%@",newStr3);
[arr addObject:newStr3];
}
NSLog(@"输出结果为:");
for(NSDictionary *dic in arr){
NSLog(@"%@",dic);
}
}
return 0;
}