Count the number of set bits (population counting) in a string. Like Redis's bitcount.
key
- start
- Optional, inclusive, if start is negative, count from start'th character from the end of string.end
- Optional, inclusive.The number of bits set to 1.
ssdb 127.0.0.1:8888> set a 123
ok
(0.000 sec)
ssdb 127.0.0.1:8888> countbit a 0 1
3
(0.000 sec)
ssdb 127.0.0.1:8888> bitcount a 0 1
6
(0.000 sec)
ssdb 127.0.0.1:8888>