Skip to content

Instantly share code, notes, and snippets.

@jkubicek
Created December 21, 2011 00:24
Show Gist options
  • Save jkubicek/1503941 to your computer and use it in GitHub Desktop.
Save jkubicek/1503941 to your computer and use it in GitHub Desktop.
Lorem ipsum generator for Obj-C
#import <Foundation/Foundation.h>
#define DEBUG
//#undef DEBUG
//>>>>> snip
#ifdef DEBUG
static inline NSString * GenerateLorumStringCharCount(NSUInteger count)
{
NSString *lorum = @"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ";
while ([lorum length] < count) {
lorum = [lorum stringByAppendingString:lorum];
}
return [lorum substringToIndex:count];
}
#endif
//<<<<< endsnip
int main(int argc, char *argv[]) {
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
NSString *lorum = GenerateLorumStringCharCount(10000);
NSLog(@"%@", lorum);
[p release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment