///要转的整数 0<num<1000
+(NSString *)returnChineseNumber:(NSUInteger)num{
NSArray *arr=@[@"一",@"二",@"三",@"四",@"五",@"六",@"七",@"八",@"九",@"十"];
if (num<1) {
return @"小于一的数";
}
if (num<11) {
return arr[num-1];
}else if (num<20){
return [NSString stringWithFormat:@"十%@",arr[num%10-1]];
}else if (!(num%10)&&num<100){
return [NSString stringWithFormat:@"%@十",arr[num/10-1]];
}else if (num<100){
return [NSString stringWithFormat:@"%@十%@",arr[num/10-1],arr[num%10-1]];
}else if(!(num%100)&&num<1000){
return [NSString stringWithFormat:@"%@百",arr[num/100-1]];
}else if (num<1000){
int num1=num%100;
if (num1<10) {
return [NSString stringWithFormat:@"%@百零%@",arr[num/100-1],arr[num1-1]];
}else if (!(num1%10)&&num1<100){
return [NSString stringWithFormat:@"%@百%@十",arr[num/100-1],arr[num1/10-1]];
}else{
return [NSString stringWithFormat:@"%@百%@十%@",arr[num/100-1],arr[num1/10-1],arr[num1%10-1]];
}
}else{
return @"大于999的数无法转化";
}
}