+(NSString*)sha_amount:(NSString*)amount{
NSScanner *scan = [NSScanner scannerWithString:amount];
int val; // 先判断整数和小数;整数直接补.0000;小数的话不够的话补0;超过的话截取
if([scan scanInt:&val] && [scan isAtEnd]){// 是整数
amount = [NSString stringWithFormat:@"%@%@",scan.string,@".0000"];
}else{
if([scan.string rangeOfString:@"."].location !=NSNotFound){
NSArray *scanArray = [scan.string componentsSeparatedByString:@"."]; //字符串按照;分隔成数
NSString*scanLast = [scanArray lastObject];
if(scanLast.length<4){
float floatString = [scan.string floatValue];
amount = [NSString stringWithFormat:@"%.4f",floatString];
}else{
amount = [NSString stringWithFormat:@"%@%@%@",[scanArray firstObject],@".",[scanLast substringToIndex:4]];
}
}
}
return amount;
}