I\'m having some problems with this.
I want to take an NSString and convert it to an integer array of only 0,1 values that would represent the binary equivalent of an as
Convert NSString to Integer:(got it from link Ben posted )
// NSString to ASCII
NSString *string = @"A";
int asciiCode = [string characterAtIndex:0]; // 65
then pass it to function below :
NSArray *arrayOfBinaryNumbers(int val)
{
NSMutableArray* result = [NSMutableArray array];
size_t i;
for (i=0; i < CHAR_BIT * sizeof val; i++) {
int theBit = (val >> i) & 1;
[result addObject:[NSNumber numberWithInt:theBit]];
}
return result;
}