Some maths questions on Obj-C
I just have two questions on Obj-C. I have a string value: "234.67". How can i change the dot to comma? Resulting 234开发者_如何学C,67?
Another questions is, how work the split/division on Obj-C? I have a value, 255.45 and i want to divide it twelve times.
Thanks!
To replace the period with a comma, you should replace it in the string when you want to display it.
NSString *str = @"234.67";
str = [str stringByReplacingOccurrencesOfString:@"."
withString:@","];
To divide you just use the operator
float j;
j = 234.67 / 12;
Good Luck.
精彩评论