Quote:
Originally Posted by RLScott
You have not made clear what you think is the right way to display the various numbers you might get.
|
sorry,
this is what I want:
This is my code and the result for each code is below it.
float total = 1*1000;
lable.text = [NSString stringWithFormat:@"%f",total];
---------------------------------------------
the result comes to : 1000.000000
and I want the result to be: 1000
---------------------------------------------
float total = 1/1000;
lable.text = [NSString stringWithFormat:@"%f",total]
---------------------------------------------
the result comes to: 0.001000
and I want the result to be 0.001
---------------------------------------------
float total = 1/100;
lable.text = [NSString stringWithFormat:@"%f",total]
---------------------------------------------
the result comes to: 0.010000
and I want the result to be 0.01
---------------------------------------------
I want to have one code for all of them, and it should auto detect how many digits it should be.