double 型转换成 金额

  • (NSString *)priceString:(double)input {

    DDLogDebug(@”input %f”,input);
    NSNumber *price = [NSNumber numberWithDouble:input];
    DDLogDebug(@”price %@”,price);
    NSNumberFormatter *nf = [NSNumberFormatter new];
    [nf setNumberStyle:NSNumberFormatterCurrencyStyle];
    nf.locale = [NSLocale localeWithLocaleIdentifier:@”zh_CN”];
    DDLogDebug(@”nf %@”,[nf stringFromNumber:price]);
    return [nf stringFromNumber:price];
    }

这里写图片描述

你可能感兴趣的:(Objective-C)