Skip to content

Instantly share code, notes, and snippets.

@klmitchell2
Created June 15, 2017 02:57
Show Gist options
  • Save klmitchell2/502659eb9461e393bd50477a4cbf3cbd to your computer and use it in GitHub Desktop.
Save klmitchell2/502659eb9461e393bd50477a4cbf3cbd to your computer and use it in GitHub Desktop.
Objective-C Pangram
- (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