NSCharacterSet* tSet = [NSCharacterSet characterSetWithCharactersInString:
@"abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
NSCharacterSet* invSet = [tSet invertedSet];
NSString* legalS = @"abcdA1";
NSString* illegalS = @"asvéq1";
if ([legalS rangeOfCharacterFromSet:invSet].location != NSNotFound)
NSLog(legalS); // not printed
if ([illegalS rangeOfCharacterFromSet:invSet].location != NSNotFound)
NSLog(illegalS); // printed
Showing posts with label string. Show all posts
Showing posts with label string. Show all posts
Sort Array
NSArray *myArray = [myArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
or
NSSortDescriptor *lastNameDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastName" ascending:YES];
[myArray sortUsingDescriptors:[NSArray arrayWithObject:lastNameDescriptor]];
Subscribe to:
Posts (Atom)