No language or library will give its user base everything that they desire, although Boost may claim to You should be collecting snippets of code as you develop to ensure you never have to write the same thing twice.
if i == 0:
s = ''
if i & 1 == 1:
s = "1" + s
s = "0" + s
i >>= 1
which will construct your binary string based on the decimal value.
The idea is to use code from (in order of preference):
- the language.
- the libraries.
- third-party libraries with suitable licenses.
- your own collection.
- something new you need to write (and save in your collection for later).