原值:2.7999999999
typedef CF_ENUM(CFIndex, CFNumberFormatterRoundingMode) {
kCFNumberFormatterRoundCeiling = 0,//四舍五入,直接输出3
kCFNumberFormatterRoundFloor = 1,//保留小数输出2.8
kCFNumberFormatterRoundDown = 2,//加上了人民币标志,原值输出¥2.8
kCFNumberFormatterRoundUp = 3,//本身数值乘以100后用百分号表示,输出280%
kCFNumberFormatterRoundHalfEven = 4,//输出2.799999999E0
kCFNumberFormatterRoundHalfDown = 5,//原值的中文表示,输出二点七九九九。。。。
kCFNumberFormatterRoundHalfUp = 6//原值中文表示,输出第三
};
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = kCFNumberFormatterRoundHalfDown;
NSString *string = [formatter stringFromNumber:[NSNumber numberWithInt:12]];
NSLog(@"str = %@", string);
阿拉伯数字转大写汉子
最新推荐文章于 2023-12-08 14:56:58 发布