Created
January 10, 2011 04:13
-
-
Save kwylez/772344 to your computer and use it in GitHub Desktop.
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
/** | |
* Assume that first name is the first instance of characters before the first | |
* " ". Everything else will be considered the last name. | |
*/ | |
NSArray *nameSplitArray = [self.employee.name componentsSeparatedByString:@" "]; | |
NSMutableArray *nameSplitMutableArray = [nameSplitArray mutableCopy]; | |
[nameSplitMutableArray removeObjectAtIndex:0]; | |
// set the first and last name properties | |
ABRecordSetValue(person, kABPersonFirstNameProperty, (CFStringRef)[nameSplitArray objectAtIndex:0], &error); | |
ABRecordSetValue(person, kABPersonLastNameProperty, (CFStringRef)[nameSplitMutableArray componentsJoinedByString:@","], &error); | |
[nameSplitMutableArray release]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment