My objective is to create a customer calculator application for iPhone and am using Xcode to write my application. My problem that I cannot find a solution for is how to format a number without using scientific notation or a set number of decimals.
I tried...
buttonScreen.text = [NSString stringWithFormat:@"%f",currentNumber];
buttonScreen.text = [NSString stringWithFormat:@"%g",currentNumber];
%f formatting always prints 6 digits after the decimal place so if the user types in "5" it displays 5.000000.
%g formatting jumps to scientific notation after 6 digits so 1000000 becomes 1e+06 when displayed.
I want to be able to have the following numbers display without pointless decimals or scientific notation:
123,456,789;
1.23456789;
12345.6789;
-123,456,789;
-1.23456789;
-12345.6789;
%s to your format strings. If I misrepresented something, please let me know! Also, good first question. - Carl Veazey