Possible duplicate:
Is NSString an integer?
I searched the last half hour, trying to find an easy way to convert an instance of NSString to an integer and be able to determine if the string was correctly formatted. So far, I could not find anything. There are methods intValueand integerValuein an NSString, but they just return 0 if they are incorrectly formatted. In my case, 0 is a real number. There's also an NSNumberFormatter that will parse the decimal without problems, but as far as I can tell, it doesn't execute integers, although I can just miss something.
It seems to be too simple for the problem to not be excluded from the Foundation. I would appreciate it if someone points me in the right direction.
source
share