gpt4 book ai didi

ios - 为什么 NSNumberFormatter 不接受加号

转载 作者:行者123 更新时间:2023-11-29 11:20:11 24 4
gpt4 key购买 nike

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]);
}
}

我发现了什么:

0   good
-19.49883745 good
+38.85928608 bad
+46.94000154 bad
-0.36042119 good
+38.30408636 bad
-44.29029741 good
+26.91823821 bad
-79.06183133 good
-16.69693020 good

最佳答案

尝试这样做:

[myNumberFormatter setPositivePrefix:@"+"];

在调用 numberForString 之前

关于ios - 为什么 NSNumberFormatter 不接受加号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7630192/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com