- (NSString *)decimalwithFormat:(NSData *)dataV {
if (dataV == nil) {
return @"0";
}
NSData *ff = [DataConvert hexStringToData:@"FFFFFFFF"];
NSInteger addupInt;
NSString *resultStr;
float addupF = 0.00;
if ([[dataV subdataWithRange:NSMakeRange(0, 1)] isEqualToData:[DataConvert hexStringToData:@"ff"]]) {
addupInt = [DataConvert dataToInteger:ff] - [DataConvert dataToInteger:dataV];
addupF = (addupInt + 1) * 0.01;
resultStr = [NSString stringWithFormat:@"-%.2f",addupF];
} else {
addupInt = [DataConvert dataToInteger:dataV];
addupF = addupInt * 0.01;
resultStr = [NSString stringWithFormat:@"%.2f",addupF];
}
NSLog(@"格式化数据 -- %@",resultStr);
return resultStr;
}
十六进制带符号(-号)
最新推荐文章于 2021-06-18 11:31:40 发布