Created
June 15, 2017 02:57
-
-
Save klmitchell2/502659eb9461e393bd50477a4cbf3cbd to your computer and use it in GitHub Desktop.
Objective-C Pangram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)pangram { | |
NSMutableSet *set = [[NSMutableSet alloc] init]; | |
for (int i = 0; i < self.length; i++) { | |
if ([[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:[self characterAtIndex:i]]) { | |
[set addObject:[NSString stringWithFormat:@"%c", [self characterAtIndex:i]]]; | |
} else if ([[NSCharacterSet lowercaseLetterCharacterSet] characterIsMember:[self characterAtIndex:i]]) { | |
[set addObject:[NSString stringWithFormat:@"%c", [self characterAtIndex:i]]]; | |
} else { | |
NSLog(@"space character"); | |
} | |
} | |
if (set.count >= 26) { | |
return TRUE; | |
} else { | |
return FALSE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment