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
+(NSArray *)splitString:(NSString *)str maxCharacters:(NSInteger)maxLength | |
{ | |
NSMutableArray *tempArray = [NSMutableArray arrayWithCapacity:1]; | |
NSArray *wordArray = [str componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; | |
NSInteger numberOfWords = [wordArray count]; | |
NSInteger index = 0; | |
NSInteger lengthOfNextWord = 0; | |
while (index < numberOfWords) { |
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
#import <Foundation/Foundation.h> | |
int ageOfJosh(int realAge) | |
{ | |
int statedAge = 29; | |
if (realAge > 29) { | |
return statedAge; | |
} | |
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
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSArray *names = @[@"Jones", @"Carvin", @"Cuckler", @"Davis", @"Etchison", @"Gable", @"Barrow"]; | |
int nameIndex = arc4random_uniform([names count]); | |
NSLog(@"%@", names[nameIndex]); | |
} |
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
if ((![phoneNumber isEqualToString:[NSString string]]) && phoneNumber) { | |
// phone number exists | |
} | |
else if (([phoneNumber isEqualToString:[NSString string]]) && phoneNumber) { | |
phoneNumber = [user phone]; | |
} |