I'd like to convert an int to a string in Objective-C. How can I do this?
标签:
objective-c
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
- Why is my library not able to expand on the CocoaP
Primitives can be converted to objects with
@()
expression. So the shortest way is to transformint
toNSNumber
and pick up string representation withstringValue
method:or
This is one of many ways.
If this string is for presentation to the end user, you should use
NSNumberFormatter
. This will add thousands separators, and will honor the localization settings for the user:In the US, for example, that would create a string
10,000
, but in Germany, that would be10.000
.