Anybody has some code in objective-c to convert a NSInteger or NSString to binary string?
example:
56 -> 111000
There are some code in stackoverflow that try do this, but it doesn´t work.
Thanks
Anybody has some code in objective-c to convert a NSInteger or NSString to binary string?
example:
56 -> 111000
There are some code in stackoverflow that try do this, but it doesn´t work.
Thanks
Tooting my own horn a bit here...
I've written a math framework called
CHMath
that deals with arbitrarily large integers. One of the things it does is allows the user to create aCHNumber
from a string, and get its binary representation as a string. For example:Logs:
The framework is freely available on its Github repository.
Not sure which examples on SO didn't work for you, but Adam Rosenfield's answer here seems to work. I've updated it to remove a compiler warning: