Why does NSNumberFormatter not accept plus number
if(![myNumberFormatter numberFromString:[tempColumn objectAtIndex:j]])
{
numericalColumns[j] = NO;
if(j == 8)
{
NSLog(@" non numerical value in column 8 i = %d object = %@ ", i , [tempColumn objectAtIndex:j]);
}
}
What I find:
0 good
-19.49883745 good
+38.85928608 bad
+46.94000154 b开发者_开发技巧ad
-0.36042119 good
+38.30408636 bad
-44.29029741 good
+26.91823821 bad
-79.06183133 good
-16.69693020 good
Try doing this:
[myNumberFormatter setPositivePrefix:@"+"];
before calling numberForString
精彩评论