Showing posts with label find NSString contains only numbers.. Show all posts
Showing posts with label find NSString contains only numbers.. Show all posts

Monday, April 30, 2012

How to check if NSString contains only numbers.




NSCharacterSet *_NumericOnly = [NSCharacterSet decimalDigitCharacterSet];
NSCharacterSet *myStringSet = [NSCharacterSet characterSetWithCharactersInString:mystring];
    
if ([_NumericOnly isSupersetOfSet: myStringSet])
{
    //String entirely contains decimal numbers only.
   
        
}