为了方便阅读,app中的金额需要用,隔开
//数字3个字一个逗号隔开,如:1,000.98
+ (NSString *)separatePer3WithNumStr:(NSString *)numStr{
double oldf = [numStr doubleValue];
long long oldll = [numStr longLongValue];
YTLog(@"%@--%f---%lld",numStr,oldf,oldll);
double tmptf = oldf - oldll;
NSString *currencyStr = nil;
if(tmptf > 0){
currencyStr = [NSNumberFormatter localizedStringFromNumber:[NSNumber numberWithDouble:oldf]
numberStyle:NSNumberFormatterDecimalStyle];
}else{
currencyStr = [NSNumberFormatter localizedStringFromNumber:[NSNumber numberWithLongLong:oldll]
numberStyle:NSNumberFormatterDecimalStyle];
}
return currencyStr;
}