Any way to auto-reformat Binary without extra tail "000s..."

Hi, using the Dec to Bin convertion, I’ve pickup this lines of codes which seem to do the job :

dek = 21
string(bswap(dek), base = 2)

Now, in this way I’m getting a very long format :

…A bit too loing for me;
So, is there a way to *auto reformat the Binary output so that it will returns only the needed number digit lenght: ie; “10101” …without a zilion 0 behind ?
61 bit length ???
*auto meaning here, it should also adapt to the input number I’m using from 1 to 1000000 for example.

Ooops ! I ve just removed the bswap (???) and it returns what I wanted now !
:upside_down_face: :smile:

1 Like