Objective-c convert Long and float to String
I need to convert two numbers to string in Objective-C. One is a long number and the other is a float. I searched on the internet for a solution and everyone uses stringWithFormat: but I can't make it work. I try NSString *myString = [NSString stringWithFormat: @"%f", floatValue] for 12345678.1234 and get "12345678.00000" as output and NSString *myString = [NSString stringWithFormat: @"%d", longValue] Can somebody show me how to use stringWithFormat: correctly? This article discusses how to use various formatting strings to convert numbers/objects into NSString instances: String Programming