How does one find a '.' in a string object in Object-C
- by NaZer
I am working on getting a simple calculator working as part of my adventure to learning Object-C and iOS development.
In Object-C using NSString, how does one look for a period in a string?
Based on the comments this is what I got so far.
NSString * tmp = [display text];
NSLog(@"%@", tmp); // Shows the number on the display correctly
int x = [tmp rangeOfString:@"."].location;
NSLog(@"%i", x); // Shows some random signed number
if (x < 0) {
[display setText:[[display text] stringByAppendingFormat:@"."]];
}
It is still not working :(