RosettaCodeData/Task/LZW-compression/Objective-C/lzw-compression-2.m
2014-04-02 16:56:35 +00:00

21 lines
470 B
Objective-C

NSString *text = @"TOBEORNOTTOBEORTOBEORNOT";
int main()
{
@autoreleasepool {
NSMutableArray *array = [[NSMutableArray alloc] init];
LZWCompressor *lzw = [[LZWCompressor alloc]
initWithArray: array ];
if ( lzw )
{
[lzw compressData: [text dataUsingEncoding: NSUTF8StringEncoding]];
for ( id obj in array )
{
printf("%u\n", [obj unsignedIntValue]);
}
}
}
return EXIT_SUCCESS;
}