开发者

Convert string value into float value

How do I convert a string to a float in Objective-C?

I am trying to add a couple of strings I am getting back from XML:

float subTotal = [[[[pintsary objectAtIndex:i]objectForKey:@"Price"] floatValue];

NSLog(@"%@",subTotal));开发者_开发知识库

but it gives error


NSLog(@"%@",subTotal);

is wrong: You want to print a float value, not an object. Use %f instead.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜