-/**
**
* 3,000 支持最长位数 16
*/
**- (NSString *)getMoneyStrWithLimitSingle:(double)limitSingle
{
NSInteger temp = floor(limitSingle);
NSMutableString * tempStr = [NSMutableString string];
while (temp/1000!=0)
{
NSInteger remainder = temp%1000;
NSString * str = nil;
if (remainder == 0)
{
str = @",000";
}else
{
str = [NSString stringWithFormat:@",%ld",(long)remainder];
}
temp = temp/1000;
[tempStr insertString:str
atIndex:0];
}
if (temp>0)
{
[tempStr insertString:[NSString stringWithFormat:@"%ld",(long)temp]
atIndex:0];
}
//小数部分处理
if (limitSingle-floor(limitSingle)>0)
{
[tempStr appendString:[NSString stringWithFormat:@".%.f",(limitSingle-floor(limitSingle))*100]];
}else
{
[tempStr appendString:@".00"];
}
return tempStr;
}
# 金额按照"3,000"的格式显示
最新推荐文章于 2021-02-26 17:26:11 发布