-(NSString *)formatFloat:(float)f{
if(fmodf(f,1) ==0) {
return [NSString stringWithFormat:@"%.0f",f];
}elseif(fmodf(f*10,1) ==0) {
return [NSString stringWithFormat:@"%.1f",f];
}else{
return [NSString stringWithFormat:@"%.2f",f];
}
}
if ([giftModel.gift_total_price floatValue] <= 0) {
self.moneylabel.text = @"0";
}else{
self.moneylabel.text = [NSString stringWithFormat:@"%@",[self formatFloat:([giftModel.gift_total_price floatValue])]];
}
网友评论