格式:###,###.## * * @param number 金额字符串 * * @return */ - (NSString*) formatAmount:(NSString*)number { NSMutableString *resultStr = [NSMutableString stringWithFormat:@"%.2f",[number doubleValue]]; BOOL bellowZearo = NO; if ([number doubleValue]<0) { bellowZearo = YES; [resultStr replaceCharactersInRange:NSMakeRange(0, 1) withString:@""]; } int count = ([resultStr length]-1)/3-2; int mod = [resultStr length]%3==0?3:[resultStr length]%3; for (int i=0; i<=count; i++) { [resultStr insertString:@"," atIndex:mod+3*(count-i)]; } if (bellowZearo) { [resultStr insertString:@"-" atIndex:0]; } return resultStr; }