I hope you can help me out with this ‘small’ problem. I want to convert a string to a double/float.
NSString *stringValue = @"1235";
priceLabel.text = [NSString stringWithFormat:@"%d",[stringValue doubleValue]/(double)100.00];
I was hoping this to set the priceLabel to 12,35 but I get some weird long string meaning nothing to me.
I have tried:
priceLabel.text = [NSString stringWithFormat:@"%d",[stringValue intValue]/(double)100.00];
priceLabel.text = [NSString stringWithFormat:@"%d",[stringValue doubleValue]/100];
but all without success.
You have to use %f to show float/double value.
then %.2f means 2digits after dot
OUTPUT:
str : 12.35