开发者

Convert string value into float value

开发者 https://www.devze.com 2023-03-05 03:31 出处:网络
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:

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

精彩评论

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