开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜