Prevent printing -0
- by fishinear
If I do the following in Objective-C:
NSString *result = [NSString stringWithFormat:@"%1.1f", -0.01];
It will give result @"-0.0"
Does anybody know how I can force a result @"0.0" (without the "-") in this case?
EDIT:
I tried using NSNumberFormatter, but it has the same issue. The following also produces @"-0.0":
double value = -0.01;…