for example
str = 'f01288c2' #a hexadecimal string
bin = str.to_i(16).to_s(2).rjust(str.length + (64 - (str.length % 64)), '0')
so the size of the binary string is always the multiply of 64.
The problem here is, the str.length is the length before it’s converted into binary. I need the length of the string after to_s(2). How do I access the return value of the to_s(2)?
Update
I wonder if there is a one chain solution.
The one-line solution would use
Kernel#tapandstr.replace: