Only one comma/point in the calculator! Objective-C for iPhone -


i'm putting calculatorapp iphone , there 1 thing need end, floating-point!

as in normal calculators, need permit 1 "." .

can dudes me?

you have few ways go, such as, nsstring's rangeofstring method, e.g.

#define floating_point_string @"."; // set @"." or @"," according floating point type want use float calculatortext = 45.194; // set whatever label says, or can skip float => string conversion shown below nsstring *text = [nsstring stringwithformat:@"%f", calculatortext];  if ([text rangeofstring:floating_point_string].location != nsnotfound) {     // nothing, there floating point } else {  // append floating_point_string label } 

good luck ;)


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -