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
Post a Comment