Saturday, 11 April 2015

BITCOUNT : Count the number of bits set in given string


Synax
BITCOUNT key
Returns the number of bits set in given string.

BITCOUNT key start end
Returns the number of bits set in given string from start offset to end offset.

Returns
Returns the number of bits set in given string.

127.0.0.1:6379> set myKey "a" 
OK 
127.0.0.1:6379> bitcount myKey 
(integer) 3 
127.0.0.1:6379> set myKey "hello" 
OK 
127.0.0.1:6379> get myKey 
"hello" 
127.0.0.1:6379> bitcount myKey 
(integer) 21 

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment