iOS 금액 대문자

2173 단어

말을 많이 하지 않고 바로 코드에 올리기:

-(NSString *)digitUppercase:(NSString *)numstr{
     double numberals=[numstr doubleValue];
     NSArray *numberchar = @[@" ",@" ",@" ",@" ",@" ",@" ",@" ",@" ",@" ",@" "];
    NSArray *inunitchar = @[@"",@" ",@" ",@" "];
    NSArray *unitname = @[@"",@" ",@" ",@"  "];
    //    100      (       )
    NSString *valstr=[NSString stringWithFormat:@"%.2f",numberals];
    NSString *prefix;
    NSString *suffix;
  if (valstr.length<=2) {
    prefix=@"  ";
    if (valstr.length==0) {
        suffix=@"    ";
    }
    else if (valstr.length==1)
    {
        suffix=[NSString stringWithFormat:@"%@ ",[numberchar objectAtIndex:[valstr intValue]]];
    }
    else
    {
        NSString *head=[valstr substringToIndex:1];
        NSString *foot=[valstr substringFromIndex:1];
        suffix = [NSString stringWithFormat:@"%@ %@ ",[numberchar objectAtIndex:[head intValue]],[numberchar  objectAtIndex:[foot intValue]]];
    }
}
else
{
    prefix=@"";
    suffix=@"";
    NSInteger flag = valstr.length - 2;
    NSString *head=[valstr substringToIndex:flag - 1];
    NSString *foot=[valstr substringFromIndex:flag];
    if (head.length>13) {
        return@"    (    13   ),    ";
    }
    //      
    NSMutableArray *ch=[[NSMutableArray alloc]init];
    for (int i = 0; i < head.length; i++) {
        NSString * str=[NSString stringWithFormat:@"%x",[head characterAtIndex:i]-'0'];
        [ch addObject:str];
    }
    int zeronum=0;
    
    for (int i=0; i

좋은 웹페이지 즐겨찾기