开发者

how to convert Float64 to NSString in iOS

开发者 https://www.devze.com 2023-02-15 09:28 出处:网络
How to 开发者_如何学JAVAconvert Float64 to NSString in objective-c?How about this: NSString *str = [NSString stringWithFormat: @\"%lf\", number];

How to 开发者_如何学JAVAconvert Float64 to NSString in objective-c?


How about this:

NSString *str = [NSString stringWithFormat: @"%lf", number];


You can also use

NSString *str = [[NSString alloc] initWithFormat: @"%lf", number];

Edit:

The difference is that you need to release the str variable in this case when you are done with it. We use init method to initialize class variables so that they can be accessible across the class and then release them in dealloc.

0

精彩评论

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